
2つの異なるビデオファイルを結合する必要があり、ロスレスカットタスク用です。ただし、ファイルのコーデック、サイズ、フレームレートは同じである必要があると書かれています。
ソースは Vorbis を使用した mkv V_MPEG4/ISO/AVC で、宛先は ac3 を使用した avi xvid です。
- ffmpeg エンコードを使用した両ファイルの完全なパラメータ
Format : AVI
Format/Info : Audio Video Interleave
File size : 6.20 MiB
Duration : 46 s 280 ms
Overall bit rate : 1 124 kb/s
Writing application : Lavf58.45.100
Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple@L5
Format settings : BVOP2
Format settings, BVOP : 2
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (MPEG)
Muxing mode : Packed bitstream
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 46 s 280 ms
Bit rate : 921 kb/s
Width : 576 pixels
Height : 432 pixels
Display aspect ratio : 3:2
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.148
Stream size : 5.08 MiB (82%)
Writing library : XviD 64
Audio
ID : 1
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : 2000
Duration : 46 s 254 ms
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 28.711 FPS (1536 SPF)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 1.06 MiB (17%)
Alignment : Aligned on interleaves
Interleave, duration : 35 ms (0.87 video frame)
Interleave, preload duration : 347 ms
Service kind : Complete Main
- 再コード化/エンコードするファイルのパラメータ(上記のパラメータが表示されるようにするため):
Format : Matroska
Format version : Version 4
File size : 2.36 MiB
Duration : 27 s 999 ms
Overall bit rate mode : Variable
Overall bit rate : 706 kb/s
Writing application : Lavf58.45.100
Writing library : Lavf58.45.100
ErrorDetectionType : Per level 1
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 27 s 933 ms
Bit rate : 564 kb/s
Width : 854 pixels
Height : 480 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.303 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.045
Stream size : 1.88 MiB (80%)
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 2
Format : Vorbis
Format settings, Floor : 1
Codec ID : A_VORBIS
Duration : 27 s 837 ms
Bit rate mode : Variable
Bit rate : 128 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Delay relative to video : -52 ms
Stream size : 435 KiB (18%)
Writing application : Lavc58.91.100
Writing library : libVorbis (Reducing Environment) (20200704 (Reducing Environment))
Default : Yes
Forced : No
宛先ファイルからすべてのデータを抽出し、FFmpeg ソース ファイル エンコード コマンドのパラメーターとして入力するにはどうすればよいでしょうか。このためのスクリプトがあるかどうか調べましたが、見つかりません。
答え1
手動で行う必要があります。
ffmpeg -i input.mkv -c:v libxvid -vf scale=-2:432 -r 25 -profile:v 0 -level 5 -vtag XVID -mpeg_quant 1 -b:v 921k -bf 2 -c:a ac3 -ac 2 -ar 44100 output.avi
答え2
まだ良い解決策は見つかっていませんが、Linuxのbashスクリプトがある結合するビデオフラグメントの相違点を見つけるタスクを自動化し、相違点を修正するためのコマンドを提案します。
答え3
これは近いです。「寸法を事前に定義せずに、1 つのビデオを別のビデオに合わせて拡大縮小する」、2 つのビデオを並べて、2 番目のビデオを 1 番目のビデオに合わせて拡大縮小する:
ffmpeg -i vid1.mp4 -i vid2.mp4 -filter_complex "[1:v][0:v]scale2ref=oh*mdar:h=in_h:[v1][v0];[v0][v1]hstack[vo]" -map "[vo]" ./output-video.mp4