I'm trying to insert 13 seconds of black video at the start of a video that has sound using ffmpeg like so:
ffmpeg -f lavfi -i "color=c=black:s=720x406:r=25:sar=1/1" -i input.mp4 -filter_complex \
"[0:v] trim=end=13,setpts=PTS-STARTPTS [blackstart]; \
[blackstart] [1:v] concat=n=2:v=1:a=0[out]" \
-map "[out]" -c:a copy output.mp4
However the sound is not being maintained. What am I doing incorrectly? -c:a copy does not seem to work should I be using a [1:a] somewhere?
garrett-retina:~ garrett-macbookretina$ ffmpeg -f lavfi -i "color=c=red:s=720x406:r=25:sar=1/1" -i input.mp4 -filter_complex \
> "[0:v] trim=end=13,setpts=PTS-STARTPTS [blackstart]; \
> [blackstart] [1:v] concat=n=2:v=1:a=0[out]" \
> -map "[out]" -c:a copy output.mp4
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, lavfi, from 'color=c=red:s=720x406:r=25:sar=1/1':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x406 [SAR 1:1 DAR 360:203], 25 tbr, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.56.100
Duration: 33:59:47.32, start: 0.000000, bitrate: 179 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x406 [SAR 1:1 DAR 360:203], 62 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, stereo, fltp, 114 kb/s (default)
Metadata:
handler_name : SoundHandler
[libx264 # 0x7fa344048400] using SAR=1/1
[libx264 # 0x7fa344048400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x7fa344048400] profile High, level 3.0
[libx264 # 0x7fa344048400] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=12 lookahead_threads=2 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=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/Users/garrett-macbookretina/Desktop/Best of Luck With the Wall/exports/test.mp4':
Metadata:
encoder : Lavf57.56.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x406 [SAR 1:1 DAR 360:203], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 (rawvideo) -> trim
Stream #1:0 (h264) -> concat:in1:v0
concat -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=3060008 fps=432 q=-1.0 Lsize= 957795kB time=34:00:00.20 bitrate= 64.1kbits/s speed=17.3x
video:921972kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.885564%
[libx264 # 0x7fa344048400] frame I:16585 Avg QP:13.67 size: 49743
[libx264 # 0x7fa344048400] frame P:770518 Avg QP:16.48 size: 91
[libx264 # 0x7fa344048400] frame B:2272905 Avg QP:25.11 size: 22
[libx264 # 0x7fa344048400] consecutive B-frames: 0.9% 0.1% 0.4% 98.6%
[libx264 # 0x7fa344048400] mb I I16..4: 10.2% 39.7% 50.1%
[libx264 # 0x7fa344048400] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.7% 0.0% 0.0% 0.0% 0.0% skip:99.1%
[libx264 # 0x7fa344048400] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.8% L0:46.9% L1:53.1% BI: 0.1%
[libx264 # 0x7fa344048400] 8x8 transform intra:39.9% inter:52.0%
[libx264 # 0x7fa344048400] coded y,uvDC,uvAC intra: 86.1% 77.1% 60.4% inter: 0.0% 0.1% 0.0%
[libx264 # 0x7fa344048400] i16 v,h,dc,p: 66% 10% 13% 11%
[libx264 # 0x7fa344048400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 20% 14% 6% 7% 7% 7% 7% 11%
[libx264 # 0x7fa344048400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 19% 11% 7% 9% 8% 8% 7% 9%
[libx264 # 0x7fa344048400] i8c dc,h,v,p: 59% 19% 17% 5%
[libx264 # 0x7fa344048400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7fa344048400] ref P L0: 53.9% 4.0% 16.6% 25.5% 0.0%
[libx264 # 0x7fa344048400] ref B L0: 27.9% 71.6% 0.5%
[libx264 # 0x7fa344048400] ref B L1: 97.6% 2.4%
[libx264 # 0x7fa344048400] kb/s:61.71
garrett-retina:~ garrett-macbookretina$
You need to add silent audio as well. One method using anullsrc:
ffmpeg \
-f lavfi -i "color=c=black:s=720x406:r=25:sar=1/1:d=13" \
-f lavfi -t 1 -i anullsrc=cl=stereo:r=16000 \
-i input.mp4 \
-filter_complex \
"[2:v]setpts=PTS-STARTPTS[video]; \
[0:v][1:a][video][2:a]concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" output.mp4
The silent audio duration only needs to be shorter than the black video duration; the concat filter will pad the rest automatically.
I'm unable to test this example at the moment, but if it is broken let me know and I can fix it later.
Related
I developed a video conferencing app that records the video streams separately, and I am now looking for a way to merge them. At the moment I am experimenting with -itsoffset and hstack to stack 2 videos side by side using this command:
ffmpeg \
-itsoffset 17 -i smaller.mp4 \
-itsoffset 0 -i bigger.mp4 \
-filter_complex hstack=inputs=2 \
-c:v libx264 -crf 23 out.mp4
The result is a side by side video where both streams remain frozen for 17 seconds then start playing, even the bigger.mp4 video that should start at time 0.
Any help would be really appreciated!
ffmpeg verbose:
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10+deb8u1)
configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libspeex --enab le-shared --enable-pthreads --enable-libopenjpeg --enable-nonfree --enable-libopus --enable-libvorbis --enable-libvpx
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, mov,mp4,m4a,3gp,3g2,mj2, from 'smaller.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:05.16, start: 0.000000, bitrate: 444 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 330 kb/s, 32 fps, 32 tbr, 16384 tbn, 64 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 103 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'bigger.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100
Duration: 00:00:22.03, start: 0.000000, bitrate: 290 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 177 kb/s, 32 fps, 32 tbr, 16384 tbn, 64 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 103 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'out.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 (h264) -> hstack:input0 (graph 0)
Stream #1:0 (h264) -> hstack:input1 (graph 0)
hstack (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x206ed00] using SAR=1/1
[libx264 # 0x206ed00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x206ed00] profile High, level 3.1
[libx264 # 0x206ed00] 264 - core 146 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=3 lookahead_threads=1 sliced_thre ads=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 scene cut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 960x360 [SAR 1:1 DAR 8:3], q=-1--1, 32 fps, 16384 tbn, 32 tbc (default)
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(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.35.100 aac
frame= 709 fps=130 q=-1.0 Lsize= 573kB time=00:00:22.12 bitrate= 212.2kbits/s dup=544 drop=0 speed=4.05x
video:478kB audio:81kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.445685%
[libx264 # 0x206ed00] frame I:3 Avg QP:16.86 size: 38355
[libx264 # 0x206ed00] frame P:190 Avg QP:18.22 size: 1633
[libx264 # 0x206ed00] frame B:516 Avg QP:16.23 size: 123
[libx264 # 0x206ed00] consecutive B-frames: 1.3% 2.8% 6.8% 89.1%
[libx264 # 0x206ed00] mb I I16..4: 6.6% 54.8% 38.6%
[libx264 # 0x206ed00] mb P I16..4: 0.4% 1.5% 0.2% P16..4: 8.7% 4.0% 1.9% 0.0% 0.0% skip:83.3%
[libx264 # 0x206ed00] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 4.2% 0.3% 0.0% direct: 0.0% skip:95.4% L0:37.2% L1:58.9% BI: 4.0%
[libx264 # 0x206ed00] 8x8 transform intra:66.2% inter:63.4%
[libx264 # 0x206ed00] coded y,uvDC,uvAC intra: 66.1% 65.6% 21.6% inter: 1.7% 1.1% 0.0%
[libx264 # 0x206ed00] i16 v,h,dc,p: 21% 26% 11% 42%
[libx264 # 0x206ed00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 23% 13% 5% 7% 8% 7% 7% 6%
[libx264 # 0x206ed00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 24% 9% 6% 7% 7% 6% 7% 7%
[libx264 # 0x206ed00] i8c dc,h,v,p: 46% 25% 20% 9%
[libx264 # 0x206ed00] Weighted P-Frames: Y:1.1% UV:0.0%
[libx264 # 0x206ed00] ref P L0: 66.0% 19.4% 12.0% 2.6% 0.0%
[libx264 # 0x206ed00] ref B L0: 87.2% 11.8% 1.0%
[libx264 # 0x206ed00] ref B L1: 95.2% 4.8%
[libx264 # 0x206ed00] kb/s:176.52
[aac # 0x204aa00] Qavg: 247.398
hstack doesn't sync by timestamps. You'll need to pad the delayed video.
ffmpeg \
-i smaller.mp4 \
-i bigger.mp4 \
-filter_complex \
"[0]tpad=start_duration=17[left];\
[left][1]hstack=inputs=2;\
[0]adelay=17s|17s[lefta];[lefta][1]amix=2" \
-c:v libx264 -crf 23 out.mp4
I'm doing some extreme slow motion in ffmpeg on a video, both video and audio track, but can't quite get my calculations correct.
The input video is 00:06:41:00 at 24fps (9624 frames).
I need the output video to be 34:00:00:00 at 24fps (2937600 frames).
I tried these for the video and audio:
setpts=305.237*PTS
atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.807668329177057
However the video overshoots by 00:01:19:08 and the audio I'm unsure, on one player it stops somewhere around 8 hours but on another it just continues. What are the correct formulas?
Also on VLC the video has grey frames between video frames - do I need to interpolate to have continuous video frames?
Edit by #Mulvya:
fred-macbookpro:~ srederiquefantune$ ffmpeg -i /Users/srederiquefantune/Desktop/test.mp4 -filter_complex "[0:v]setpts=305.237*PTS, scale=320:240[v];[0:a]atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.5, atempo=0.807668329177057[a]" -map "[v]" -map "[a]" /Users/srederiquefantune/Desktop/output2.mp4
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --disable-outdev=xv --disable-audiotoolbox --disable-videotoolbox --disable-sdl2 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --disable-filter=coreimage --disable-filter=coreimagesrc --enable-vda --disable-indev=avfoundation --arch=x86_64 --enable-yasm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/srederiquefantune/Desktop/test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
Duration: 00:06:41.25, start: 0.000000, bitrate: 2294 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2172 kb/s, 24 fps, 120 tbr, 90k tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 112 kb/s (default)
Metadata:
handler_name : VideoHandler
[libx264 # 0x104801200] using SAR=4/3
[libx264 # 0x104801200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 # 0x104801200] profile High, level 1.3
[libx264 # 0x104801200] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=3 lookahead_threads=1 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=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/Users/srederiquefantune/Desktop/output2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.56.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x240 [SAR 4:3 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc57.64.101 aac
Stream mapping:
Stream #0:0 (h264) -> setpts
Stream #0:1 (aac) -> atempo
scale -> Stream #0:0 (libx264)
atempo -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[output stream 0:1 # 0x104105420] 100 buffers queued in output stream 0:1, something may be wrong.
frame= 1 fps=0.0 q=0.0 size= 3kB time=00:00:22.01 bitrate= 1.2kbits/s
…
frame=2938515 fps=281 q=-1.0 Lsize= 2439310kB time=35:19:08.66 bitrate= 157.2kbits/s dup=2928888 drop=1 speed=12.1x
video:389302kB audio:1994106kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.345466%
[libx264 # 0x104801200] frame I:15399 Avg QP:14.27 size: 20680
[libx264 # 0x104801200] frame P:740673 Avg QP:17.21 size: 68
[libx264 # 0x104801200] frame B:2182443 Avg QP:25.83 size: 14
[libx264 # 0x104801200] consecutive B-frames: 0.9% 0.2% 0.1% 98.8%
[libx264 # 0x104801200] mb I I16..4: 7.9% 47.3% 44.8%
[libx264 # 0x104801200] mb P I16..4: 0.0% 0.1% 0.1% P16..4: 0.7% 0.1% 0.1% 0.0% 0.0% skip:99.0%
[libx264 # 0x104801200] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.1% 0.0% 0.0% direct: 0.0% skip:99.9% L0:14.0% L1:85.9% BI: 0.0%
[libx264 # 0x104801200] 8x8 transform intra:48.2% inter:52.8%
[libx264 # 0x104801200] coded y,uvDC,uvAC intra: 91.4% 90.7% 88.0% inter: 0.1% 0.1% 0.0%
[libx264 # 0x104801200] i16 v,h,dc,p: 78% 4% 11% 7%
[libx264 # 0x104801200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 13% 17% 7% 8% 10% 7% 10% 10%
[libx264 # 0x104801200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 11% 8% 10% 11% 8% 10% 9%
[libx264 # 0x104801200] i8c dc,h,v,p: 62% 15% 16% 7%
[libx264 # 0x104801200] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x104801200] ref P L0: 87.6% 7.8% 4.0% 0.6% 0.0%
[libx264 # 0x104801200] ref B L0: 50.0% 49.6% 0.4%
[libx264 # 0x104801200] ref B L1: 91.3% 8.7%
[libx264 # 0x104801200] kb/s:26.05
[aac # 0x104802a00] Qavg: 632.499
fred-macbookpro:~ srederiquefantune$
When I add a watermark image with a landscape orientation to a video that has a portrait orientation the video automatically rotates to landscape. How do I prevent this? Also, the audio file isn't being merged into the output. How can I include the audio.mp3 to be the sole audio track?
ffmpeg -i 1425500438.MOV -i hashtag.png -itsoffset 00:00:07 -i audio.mp3 -filter_complex "[0:v]curves=preset=vintage[a];[a][1:v]overlay=10:10[out]" -vcodec libx264 -pix_fmt yuv420p -ss 0:0:07 -t 14 -map "[out]" -y processed.mov
EDIT****
ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 19 2014 12:48:02 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1425500438.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2015-03-04 20:20:14
encoder : 8.1.2
encoder-eng : 8.1.2
date : 2015-03-04T14:20:14-0600
date-eng : 2015-03-04T14:20:14-0600
model : iPhone 6
model-eng : iPhone 6
make : Apple
make-eng : Apple
Duration: 00:00:10.56, start: 0.000000, bitrate: 703 kb/s
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 480x360, 696 kb/s, 30.02 fps, 30.08 tbr, 600 tbn, 1200 tbc (default)
Metadata:
rotate : 90
creation_time : 2015-03-04 20:20:14
handler_name : Core Media Data Handler
Input #1, image2, from 'hashtag.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #1:0: Video: png, rgba, 131x29, 25 tbr, 25 tbn, 25 tbc
Input #2, mp3, from 'audio.mp3':
Metadata:
encoder : Lavf55.19.104
Duration: 00:00:10.44, start: 0.000000, bitrate: 128 kb/s
Stream #2:0: Audio: mp3, 16000 Hz, stereo, s16p, 128 kb/s
[libx264 # 0x7f9894017200] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX AVX2 FMA3 BMI1 BMI2
[libx264 # 0x7f9894017200] profile High, level 3.0
[libx264 # 0x7f9894017200] 264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=12 lookahead_threads=2 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=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mov, to 'processed.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
make-eng : Apple
make : Apple
encoder-eng : 8.1.2
date : 2015-03-04T14:20:14-0600
date-eng : 2015-03-04T14:20:14-0600
model : iPhone 6
model-eng : iPhone 6
encoder : Lavf55.19.104
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 480x360, q=-1--1, 11552 tbn, 30.08 tbc (default)
Stream mapping:
Stream #0:0 (h264) -> curves
Stream #1:0 (png) -> overlay:overlay
overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame= 422 fps=413 q=-1.0 Lsize= 361kB time=00:00:13.96 bitrate= 211.9kbits/s dup=303 drop=0
video:356kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.574185%
[libx264 # 0x7f9894017200] frame I:2 Avg QP:20.09 size: 19764
[libx264 # 0x7f9894017200] frame P:134 Avg QP:22.29 size: 2248
[libx264 # 0x7f9894017200] frame B:286 Avg QP:28.02 size: 79
[libx264 # 0x7f9894017200] consecutive B-frames: 9.2% 0.0% 3.6% 87.2%
[libx264 # 0x7f9894017200] mb I I16..4: 6.6% 45.0% 48.4%
[libx264 # 0x7f9894017200] mb P I16..4: 1.8% 2.4% 0.7% P16..4: 40.8% 13.6% 4.5% 0.0% 0.0% skip:36.1%
[libx264 # 0x7f9894017200] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 10.9% 0.1% 0.0% direct: 0.0% skip:89.0% L0:56.5% L1:42.3% BI: 1.2%
[libx264 # 0x7f9894017200] 8x8 transform intra:47.6% inter:61.5%
[libx264 # 0x7f9894017200] coded y,uvDC,uvAC intra: 51.3% 81.4% 36.7% inter: 5.6% 8.5% 0.5%
[libx264 # 0x7f9894017200] i16 v,h,dc,p: 21% 27% 12% 40%
[libx264 # 0x7f9894017200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 27% 19% 5% 4% 4% 7% 5% 6%
[libx264 # 0x7f9894017200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 22% 12% 4% 5% 5% 6% 4% 6%
[libx264 # 0x7f9894017200] i8c dc,h,v,p: 40% 28% 22% 10%
[libx264 # 0x7f9894017200] Weighted P-Frames: Y:16.4% UV:10.4%
[libx264 # 0x7f9894017200] ref P L0: 73.7% 12.2% 11.7% 2.3% 0.2%
[libx264 # 0x7f9894017200] ref B L0: 93.5% 5.8% 0.7%
[libx264 # 0x7f9894017200] ref B L1: 97.2% 2.8%
[libx264 # 0x7f9894017200] kb/s:207.25
Problem 1
When I add a watermark image with a landscape orientation to a video that has a portrait orientation the video automatically rotates to landscape. How do I prevent this?
The problem is the rotate metadata in the video stream. In your case this is set by the iPhone. The video is not actually recorded "vertically", but the player is supposed to use the rotation metadata to rotate it upon playback. Unfortunately, some players pay attention to this metadata, such as QuickTime, while others ignore it, such as VLC. Due to the inconsistency of players and because ffmpeg preserves the stream metadata this can cause issues.
What to do:
Since you're filtering anyway you can use one of many rotation capable filters to reposition the video.
Strip out the video stream rotation metadata.
Problem 2
The audio file isn't being merged into the output. How can I include the audio.mp3 to be the sole audio track?
Since you used the -map option the default stream selection behavior was disabled. It's generally a better idea to explicitly define the inputs/streams you want, so just add another -map to map the audio.
Example
ffmpeg -i video.mov -i logo.png -i audio.mp3 -filter_complex \
"[0:v]transpose=2,curves=preset=vintage[bg]; \
[bg][1:v]overlay=10:10,format=yuv420p[vid]" \
-c:v libx264 -metadata:s:v rotate="" -map "[vid]" -map 2:a -c:a copy \
-shortest output.mov
Also see:
FFmpeg Documentation: -map option
FFmpeg Wiki: H.264 Encoding Guide
Stack Overflow: FFmpeg mux video and audio from another input - mapping
I want to concat two video files using the concat filter. The first file has to be included fully, whereas the second video must be included from the 10th second. Do I need to first create an intermediate file starting from the 10th second, or can I do it in one step?
The command I am using is
/usr/local/bin/ffmpeg -i intro.mp4 -i input.mp4 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
I tried specifying -ss after -i input.mp4, but it is applied on the final output file.
iMac:files joyce$ /usr/local/bin/ffmpeg -i intro.mp4 -i input.mp4 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 22 2014 16:19:43 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libfdk-aac
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'intro.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104
Duration: 00:00:03.05, start: 0.046440, bitrate: 1304 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 1167 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 132 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104
episode_sort : 1
season_number : 1
media_type : 9
hd_video : 0
Duration: 00:00:45.43, start: 0.042667, bitrate: 906 kb/s
Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 774 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'output.mp4' already exists. Overwrite ? [y/N] y
[libx264 # 0x7fa9a8828e00] using SAR=1/1
[libx264 # 0x7fa9a8828e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 # 0x7fa9a8828e00] profile High, level 3.1
[libx264 # 0x7fa9a8828e00] 264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=6 lookahead_threads=1 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=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 1:1 DAR 5:4], q=-1--1, 30k tbn, 29.97 tbc (default)
Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Stream mapping:
Stream #0:0 (h264) -> scale
Stream #0:1 (aac) -> concat:in0:a0
Stream #1:0 (h264) -> scale
Stream #1:1 (aac) -> concat:in1:a0
concat -> Stream #0:0 (libx264)
concat -> Stream #0:1 (libfaac)
Press [q] to stop, [?] for help
frame= 1453 fps= 42 q=-1.0 Lsize= 4536kB time=00:00:48.50 bitrate= 766.1kbits/s dup=227 drop=0
video:3796kB audio:691kB subtitle:0 global headers:0kB muxing overhead 1.102067%
[libx264 # 0x7fa9a8828e00] frame I:31 Avg QP:17.02 size: 14953
[libx264 # 0x7fa9a8828e00] frame P:764 Avg QP:24.14 size: 3677
[libx264 # 0x7fa9a8828e00] frame B:658 Avg QP:28.17 size: 933
[libx264 # 0x7fa9a8828e00] consecutive B-frames: 36.4% 6.2% 10.3% 47.1%
[libx264 # 0x7fa9a8828e00] mb I I16..4: 40.4% 32.3% 27.3%
[libx264 # 0x7fa9a8828e00] mb P I16..4: 6.6% 4.0% 1.1% P16..4: 25.2% 5.7% 2.3% 0.0% 0.0% skip:55.0%
[libx264 # 0x7fa9a8828e00] mb B I16..4: 0.8% 0.4% 0.2% B16..8: 24.5% 1.7% 0.2% direct: 0.5% skip:71.6% L0:50.7% L1:45.5% BI: 3.9%
[libx264 # 0x7fa9a8828e00] 8x8 transform intra:33.3% inter:59.0%
[libx264 # 0x7fa9a8828e00] coded y,uvDC,uvAC intra: 26.4% 41.2% 8.0% inter: 5.6% 7.9% 0.2%
[libx264 # 0x7fa9a8828e00] i16 v,h,dc,p: 46% 29% 8% 17%
[libx264 # 0x7fa9a8828e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 19% 28% 3% 3% 4% 3% 4% 3%
[libx264 # 0x7fa9a8828e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 22% 13% 4% 6% 7% 5% 5% 3%
[libx264 # 0x7fa9a8828e00] i8c dc,h,v,p: 57% 19% 20% 4%
[libx264 # 0x7fa9a8828e00] Weighted P-Frames: Y:1.8% UV:1.2%
[libx264 # 0x7fa9a8828e00] ref P L0: 73.2% 9.1% 11.7% 5.3% 0.7%
[libx264 # 0x7fa9a8828e00] ref B L0: 89.3% 8.9% 1.8%
[libx264 # 0x7fa9a8828e00] ref B L1: 95.3% 4.7%
[libx264 # 0x7fa9a8828e00] kb/s:641.26
I had placed the -ss argument after the -i option, which was why it was not applied correctly.
/usr/local/bin/ffmpeg -i intro.mp4 -i input.mp4 -ss 1.5 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
I tried placing it before -i option, and now it is working as expected.
/usr/local/bin/ffmpeg -i intro.mp4 -ss 1.5 -i input.mp4 -filter_complex '[0:v] scale=720:576 [in1]; [1:v] scale=720:576 [in2]; [in1][in2] concat [v]; [0:a][1:a] concat=v=0:a=1 [a]' -map '[v]' -map '[a]' output.mp4
According to documentation %{}:, should be escaped with slash. But when I escape % the text is not added. There's error message saying Stray % near ')'. But what does it mean and how I can fix it? Command and output:
$ /usr/bin/ffmpeg -y -i /home/www/255871.mov -af 'aresample=async=1:min_hard_comp=0.100000' -vf 'scale=480:trunc(ow/a/2)*2,transpose=1 [in];movie=watermarks/text-box440.mov,scale=320:55 [bg];[in][bg] overlay=x=20:y=main_h-80,drawtext=fontsize=20:fix_bounds=1:fontfile=Helvetica\\:Style=bold:fontcolor=0xe6b300:text=small kitten \%\):x=30:y=h-80+ascent/2:draw=gte(t\,0)\;lt(t\,5) [out]' -pix_fmt yuv420p -r 24.39 -map_metadata -1 -movflags +faststart -f mp4 -vcodec libx264 -b:v 800k -maxrate 1100k -bufsize 2M -bt 256k -profile:vbaseline -acodec libfdk_aac -ab 64k -ar 44100 -ac 1 /tmp/kitten.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 15 2013 18:40:14 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libvo-aacenc --enable-libx264 --enable-version3 --enable-pthreads --enable-libfaac --enable-nonfree --enable-libfdk_a
ac --enable-fontconfig --enable-libfreetype
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/www/255871.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2012-07-17 07:42:35
model : iPhone 3GS
model-rus : iPhone 3GS
encoder : 4.2.1
encoder-rus : 4.2.1
date : 2012-07-17T10:42:35+0300
date-rus : 2012-07-17T10:42:35+0300
make : Apple
make-rus : Apple
Duration: 00:00:09.38, start: 0.000000, bitrate: 790 kb/s
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 720 kb/s, 29.97 fps, 29.97 tbr, 600 tbn, 1200 tbc
Metadata:
rotate : 90
creation_time : 2012-07-17 07:42:35
handler_name : Core Media Data Handler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s
Metadata:
creation_time : 2012-07-17 07:42:35
handler_name : Core Media Data Handler
[Parsed_drawtext_5 # 0x2ae9b00] Using "/usr/share/fonts/default/Type1/n019003l.pfb"
[libx264 # 0x2ae7d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x2ae7d40] profile Constrained Baseline, level 2.1
[libx264 # 0x2ae7d40] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1100 vbv_bufsize=2000 nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/tmp/kitten.mp4':
Metadata:
encoder : Lavf54.63.104
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 360x480, q=-1--1, 800 kb/s, 19512 tbn, 24.39 tbc
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 64 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (aac -> libfdk_aac)
Press [q] to stop, [?] for help
[Parsed_drawtext_5 # 0x2ae9b00] Stray % near ')'
Last message repeated 201 times
Stray % near ')'0.0 q=27.0 size= 480kB time=00:00:07.96 bitrate= 493.4kbits/s dup=0 drop=35
[Parsed_drawtext_5 # 0x2ae9b00] Stray % near ')'
Last message repeated 77 times
Starting second pass: moving header on top of the file
frame= 231 fps=0.0 q=-1.0 Lsize= 1002kB time=00:00:09.47 bitrate= 866.6kbits/s dup=0 drop=50
video:921kB audio:74kB subtitle:0 global headers:0kB muxing overhead 0.680957%
[libx264 # 0x2ae7d40] frame I:1 Avg QP:24.43 size: 13264
[libx264 # 0x2ae7d40] frame P:230 Avg QP:23.72 size: 4041
[libx264 # 0x2ae7d40] mb I I16..4: 24.8% 0.0% 75.2%
[libx264 # 0x2ae7d40] mb P I16..4: 2.3% 0.0% 4.8% P16..4: 34.4% 28.8% 9.4% 0.0% 0.0% skip:20.3%
[libx264 # 0x2ae7d40] coded y,uvDC,uvAC intra: 62.5% 54.2% 4.4% inter: 19.6% 20.3% 0.1%
[libx264 # 0x2ae7d40] i16 v,h,dc,p: 36% 29% 19% 16%
[libx264 # 0x2ae7d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 21% 20% 6% 8% 7% 7% 6% 6%
[libx264 # 0x2ae7d40] i8c dc,h,v,p: 65% 15% 17% 3%
[libx264 # 0x2ae7d40] ref P L0: 93.4% 4.3% 2.3%
[libx264 # 0x2ae7d40] kb/s:796.32
Found the solution. The reason of this error is that ffmpeg tries to expand text with % to function as stated in documentation:
Sequence of the form %{...} are expanded. The text between the braces
is a function name, possibly followed by arguments separated by ’:’.
If the arguments contain special characters or delimiters (’:’ or
’}’), they should be escaped.
So simply adding expansion=none to filter configuration solves the issue.