[FFmpeg-user] Concat limited to certain file types?
Jan Ehrhardt
phpdev at ehrhardt.nl
Wed Oct 17 01:59:33 CEST 2012
Jan Ehrhardt in gmane.comp.video.ffmpeg.user (Tue, 16 Oct 2012 18:30:03 +0200):
>I am now struggling with the complex_filter. I cannot yet figure out how
>to combine scale and complex_filter concat if the video and audio
>duration in the first file(s) are not the same. Is that possible at all?
OK, so that was
-filter_complex " \
[0:0] scale=384:288 [0:2], \
[1:0] scale=384:288 [1:2], \
[0:2] [0:1] [1:2] [1:1] concat=n=2:v=1:a=1 [v] [a]"
-map [v] -map [a]
or
-filter_complex " \
[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]"
-map [v] -map [a] -s 384x288
And now for the big disappointment. I was hoping to find a single
commandline to rescale and stitch all kinds of video files (MPG,
MP4, MTS, MOD, MOV), but a camera like the Sony CX160 produces MPG
files that cannot be handled by filter_complex, but only by
-concat:"file1.mpg|file2.mpg". And gone is my hope for a single
commandline :-(
FFProbe shows the starttime of the first file to be almost, but not
quite 0 seconds. And the starttime of the second file (automatically
generated when the first file hit the 2GB boundary) is the endtime of
the first file.
Input #0, mpeg, from 'sd00004.mpg':
Duration: 00:30:18.68, start: 0.226767, bitrate: 9309 kb/s
Stream #0:0[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 64:45 DAR 16:9], 9100 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Input #0, mpeg, from 'sd00005.mpg':
Duration: 00:29:42.42, start: 1818.722767, bitrate: 9327 kb/s
Stream #0:0[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 64:45 DAR 16:9], 9100 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
http://ffmpeg.org/ffmpeg.html#concat-1 states that the concat filter
only works correctly if all segments must start at timestamp 0. And
this is the resulting error message:
Stream specifier ':0' in filtergraph description [0:0] [0:1] [1:0] [1:1]
concat=n=2:v=1:a=1 [v] [a] matches no streams.
I am not convinced yet that filter_complex is completely useless for the
Sony CX160 MPG files. If -concat:"file1.mpg|file2.mpg" works, surely
there must be a way to do that with filter_complex? But how?
Jan
PS. In case you might wonder: I am limited by the space on SD cards, so a
simple cat>> or copy/b is out of the question.
Output by FFMpeg
ffmpeg.exe -i "U:\MP_ROOT\100PNV01\SD00004.MPG" -i "U:\MP_ROOT\100PNV01\SD00005.MPG" -filter_complex "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]" -map [v] -map [a] -movflags +faststart -s 448x256 -aspect 16:9 -sws_flags bicubic -vcodec libx264
-b:v 336k -r 25 -strict -2 -acodec libfaac -ab 96k -ar 48000 -ac 2 -x264opts
global_header=1:partitions=p8x8+b8x8+i8x8:level_idc=30:cabac=0:subq=3:qp_min=0:qp_max=51:qp_step=4:me=dia:subme=0:mixed_refs=0:me_range=16:chroma_me=1:trellis=0:8x8dct=0:cqm=flat:chroma_qp_offset=0:nr=0:keyint=25:min_keyint=12:scenecut=0:ratetol=1.0:qcomp=0.60:ip_factor=1.4:weightp=0:fast_pskip=1:frameref=1:bframes=0:mbtree=1:rc_lookahead=15:sliced_threads=0:threads=8
-y "/SD_VIDEO/PRG001/JanEhrhardt.tmp.mp4"
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 12 2012 05:31:57 with gcc 4.7.1 (GCC)
configuration: --prefix=/usr/local/x64 --enable-w32threads --enable-static --enable-libmp3lame --enable-nonfree --enable-libfaac --enable-gpl --enable-libx264 --enable-libvorbis --enable-libtheora --enable-libvpx --enable-zlib --enable-bzlib
--arch=x86_64 --cross-prefix=x86_64-w64-mingw32- --target-os=mingw32 --disable-shared --disable-doc --extra-cflags=-m64 --extra-ldflags='-m64 -L/usr/local/x64/lib'
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mpeg, from 'U:\MP_ROOT\100PNV01\SD00004.MPG':
Duration: 00:30:18.68, start: 0.226767, bitrate: 9309 kb/s
Stream #0:0[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 64:45 DAR 16:9], 9100 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Input #1, mpeg, from 'U:\MP_ROOT\100PNV01\SD00005.MPG':
Duration: 00:29:42.42, start: 1818.722767, bitrate: 9327 kb/s
Stream #1:0[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream #1:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 64:45 DAR 16:9], 9100 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream specifier ':0' in filtergraph description [0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a] matches no streams.
More information about the ffmpeg-user
mailing list