I'm attempting to concatenate two or more images sequences and transcode to h264.
The problem I am having is each source is set to start at 0, rather than one being added to the previous. My output video only shows the second sequence.
Is this possible? or do I need to do the transcode first, then run concat on the results with a simple copy as described in ticket : https://github.com/kkroening/ffmpeg-python/issues/137 ?
Here are my args prior to running the stream.
[u'-pattern_type', u'glob', u'-probesize', u'1000000', u'-r', u'25', u'-i', '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001..exr', u'-pattern_type', u'glob', u'-probesize', u'1000000', u'-r', u'25', u'-i', '/path_to/abcd_014_bdy_0010_tp01_red_4096_v001..exr', u'-filter_complex', u'[0]scale=h=trunc(ih/2)2:w=trunc(iw/2)2[s0];[s0]colormatrix=dst=bt709:src=bt601[s1];[1]scale=h=trunc(ih/2)2:w=trunc(iw/2)2[s2];[s2]colormatrix=dst=bt709:src=bt601[s3];[s1][s3]concat=n=1:v=2[s4]', u'-map', u'[s4]', u'-c:v', u'libx264', u'-crf', u'10', u'-pix_fmt', u'yuv420p', u'-profile:v', u'high444', u'-threads', u'0', '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001.seq_exr_to_h264.mp4']
and here is my ffmpeg log :
INFO:etmovie:Encoding sequence [
INFO:etmovie:Exr source detected. Profile must be set to 'high444'.
INFO:etmovie:input : {'v1': {'probesize': '1000000', 'pattern_type': 'glob', 'r': '25', 'filename': '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001..exr'}, 'v2': {'probesize': '1000000', 'pattern_type': 'glob', 'r': '25', 'filename': '/path_to/abcd_014_bdy_0010_tp01_red_4096_v001..exr'}}
INFO:etmovie:audio : {}
INFO:etmovie:output : {'pix_fmt': 'yuv420p', 'profile:v': 'high444', 'crf': '10', 'threads': '0', 'c:v': 'libx264', 'filename': '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001.seq_exr_to_h264.mp4'}
INFO:etmovie:v1 args : {'probesize': '1000000', 'pattern_type': 'glob', 'r': '25', 'filename': '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001..exr'}
INFO:etmovie:v2 args : {'probesize': '1000000', 'pattern_type': 'glob', 'r': '25', 'filename': '/path_to/abcd_014_bdy_0010_tp01_red_4096_v001..exr'}
INFO:etmovie:args : [u'-pattern_type', u'glob', u'-probesize', u'1000000', u'-r', u'25', u'-i', '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001..exr', u'-pattern_type', u'glob', u'-probesize', u'1000000', u'-r', u'25', u'-i', '/path_to/abcd_014_bdy_0010_tp01_red_4096_v001..exr', u'-filter_complex', u'[0]scale=h=trunc(ih/2)2:w=trunc(iw/2)2[s0];[s0]colormatrix=dst=bt709:src=bt601[s1];[1]scale=h=trunc(ih/2)2:w=trunc(iw/2)2[s2];[s2]colormatrix=dst=bt709:src=bt601[s3];[s1][s3]concat=n=1:v=2[s4]', u'-map', u'[s4]', u'-c:v', u'libx264', u'-crf', u'10', u'-pix_fmt', u'yuv420p', u'-profile:v', u'high444', u'-threads', u'0', '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001.seq_exr_to_h264.mp4']
ffmpeg version 4.1.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001..exr':
Duration: 00:00:01.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: exr, rgb48le, 4096x2304 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from '/path_to/abcd_014_bdy_0010_tp01_red_4096_v001..exr':
Duration: 00:00:01.96, start: 0.000000, bitrate: N/A
Stream #1:0: Video: exr, rgb48le, 4096x2304 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (exr) -> scale
Stream #1:0 (exr) -> scale
concat:out:v1 -> Stream #0:0 (libx264)
concat:out:v0 -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
[image2 @ 0x6be8a00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[libx264 @ 0x6c2ff00] using SAR=1/1e= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
[libx264 @ 0x6c2ff00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x6c2ff00] profile High, level 5.1, 4:2:0, 8-bit
[libx264 @ 0x6c2ff00] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=36 lookahead_threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=10.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x6c31280] using SAR=1/1
[libx264 @ 0x6c31280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x6c31280] profile High, level 5.1, 4:2:0, 8-bit
[libx264 @ 0x6c31280] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=36 lookahead_threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=10.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/path_to/abcd_007_mat_0010_bg01_sony_4096_v001.seq_exr_to_h264.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 4096x2304 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 4096x2304 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[image2 @ 0x6be4e80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame= 49 fps=1.2 q=-1.0 Lq=-1.0 size= 55091kB time=00:00:01.84 bitrate=245263.4kbits/s speed=0.0464x
video:55088kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004577%
[libx264 @ 0x6c2ff00] frame I:1 Avg QP: 7.67 size:986390
[libx264 @ 0x6c2ff00] frame P:17 Avg QP: 7.72 size:882642
[libx264 @ 0x6c2ff00] frame B:31 Avg QP: 8.16 size:721721
[libx264 @ 0x6c2ff00] consecutive B-frames: 14.3% 4.1% 0.0% 81.6%
[libx264 @ 0x6c2ff00] mb I I16..4: 11.4% 87.9% 0.6%
[libx264 @ 0x6c2ff00] mb P I16..4: 1.5% 65.4% 0.6% P16..4: 11.6% 6.0% 6.4% 0.0% 0.0% skip: 8.4%
[libx264 @ 0x6c2ff00] mb B I16..4: 0.6% 48.3% 0.1% B16..8: 13.8% 4.6% 2.6% direct: 6.9% skip:23.1% L0:42.6% L1:39.4% BI:18.1%
[libx264 @ 0x6c2ff00] 8x8 transform intra:97.4% inter:47.2%
[libx264 @ 0x6c2ff00] coded y,uvDC,uvAC intra: 99.1% 100.0% 99.9% inter: 38.4% 35.8% 30.3%
[libx264 @ 0x6c2ff00] i16 v,h,dc,p: 28% 3% 31% 37%
[libx264 @ 0x6c2ff00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 9% 63% 3% 4% 2% 4% 2% 3%
[libx264 @ 0x6c2ff00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 13% 27% 8% 13% 6% 9% 4% 6%
[libx264 @ 0x6c2ff00] i8c dc,h,v,p: 77% 4% 15% 5%
[libx264 @ 0x6c2ff00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x6c2ff00] ref P L0: 52.5% 2.0% 29.1% 16.4%
[libx264 @ 0x6c2ff00] ref B L0: 78.1% 17.9% 3.9%
[libx264 @ 0x6c2ff00] ref B L1: 91.0% 9.0%
[libx264 @ 0x6c2ff00] kb/s:156590.47
[libx264 @ 0x6c31280] frame I:1 Avg QP: 8.53 size:1720395
[libx264 @ 0x6c31280] frame P:6 Avg QP: 9.46 size:1148207
[libx264 @ 0x6c31280] frame B:18 Avg QP:11.77 size:524150
[libx264 @ 0x6c31280] consecutive B-frames: 4.0% 0.0% 0.0% 96.0%
[libx264 @ 0x6c31280] mb I I16..4: 15.8% 76.0% 8.2%
[libx264 @ 0x6c31280] mb P I16..4: 3.7% 21.3% 1.5% P16..4: 20.9% 23.1% 23.4% 0.0% 0.0% skip: 6.2%
[libx264 @ 0x6c31280] mb B I16..4: 0.5% 2.4% 0.1% B16..8: 28.2% 16.0% 10.5% direct:20.2% skip:22.2% L0:42.8% L1:32.2% BI:25.0%
[libx264 @ 0x6c31280] 8x8 transform intra:78.9% inter:37.8%
[libx264 @ 0x6c31280] coded y,uvDC,uvAC intra: 94.6% 99.9% 99.6% inter: 55.1% 65.9% 48.9%
[libx264 @ 0x6c31280] i16 v,h,dc,p: 27% 9% 51% 12%
[libx264 @ 0x6c31280] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 20% 41% 3% 2% 2% 3% 2% 4%
[libx264 @ 0x6c31280] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 21% 24% 6% 6% 5% 5% 5% 5%
[libx264 @ 0x6c31280] i8c dc,h,v,p: 53% 15% 24% 7%
[libx264 @ 0x6c31280] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x6c31280] ref P L0: 51.2% 4.6% 27.4% 16.8%
[libx264 @ 0x6c31280] ref B L0: 74.4% 18.3% 7.2%
[libx264 @ 0x6c31280] ref B L1: 88.8% 11.2%
[libx264 @ 0x6c31280] kb/s:144354.78
Thanks again for your help!
Example for concatenating multiple image sequences:
input = ffmpeg.concat(
ffmpeg.input('path/to/first/sequence/*.jpg', pattern_type='glob', framerate=24)
ffmpeg.input('path/to/another/sequence/*.jpg', pattern_type='glob', framerate=24)
)
input.output(…).run(…)
Is there a way to concat multiple glob inputs using command line? I'm trying this but with no luck. I'm trying variations of
ffmpeg -pattern_type glob -i 'Time Lapse 11/*.JPG'
-pattern_type glob -i 'Burst Sequence 5/*.JPG'
-pattern_type glob -i 'Burst Sequence 6/*.JPG'
-r 24 -c:v libx264 -crf 23 -preset fast -pix_fmt yuv420p tl11_fast.mp4
with -f concat or using a file list as input, but haven't found anything that works yet.
Write it with ffmpeg-python (as shown above), and then use the get_args method to get the command that ffmpeg-python would use to steer ffmpeg. Or just do it with ffmpeg-python and do not worry about the actual ffmpeg command.
Most helpful comment
Example for concatenating multiple image sequences: