I have a video of duration 14 seconds. I applied the setPTS filter to make it 3 times slow. So the total duration should be 42s (14*3). But the output gives a 49s long video. Here is the command:
ffmpeg -i video.mp4 -filter_complex "[0:v]setpts=3*PTS[v];[0:a]atempo=0.6,atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4
What is wrong with this command? I tried it for different videos but all has the same weird issue. Any help will be appreciated. Regards.
Log:
ffmpeg version git-2020-08-31-4a11a6f Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.1 (GCC) 20200805
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 58.100 / 56. 58.100
libavcodec 58.101.101 / 58.101.101
libavformat 58. 51.101 / 58. 51.101
libavdevice 58. 11.101 / 58. 11.101
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-11-20T06:28:07.000000Z
Duration: 00:00:14.72, start: 0.000000, bitrate: 688 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, unknown/bt470bg/unknown), 198x360 [SAR 1:1 DAR 11:20], 592 kb/s, 29.93 fps, 29.93 tbr, 29931 tbn, 59.86 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
Metadata:
creation_time : 2018-11-20T06:28:07.000000Z
handler_name : IsoMedia File Produced by Google, 5-11-2011
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 (h264) -> setpts
Stream #0:1 (aac) -> atempo
setpts -> Stream #0:0 (libx264)
atempo -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 # 0000021e37f15340] using SAR=1/1
[libx264 # 0000021e37f15340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0000021e37f15340] profile High, level 1.3, 4:2:0, 8-bit
[libx264 # 0000021e37f15340] 264 - core 161 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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 : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.51.101
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 198x360 [SAR 1:1 DAR 11:20], q=-1--1, 29.93 fps, 29931 tbn, 29.93 tbc (default)
Metadata:
encoder : Lavc58.101.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.101.101 aac
frame= 1313 fps=256 q=-1.0 Lsize= 2241kB time=00:00:44.11 bitrate= 416.2kbits/s dup=875 drop=0 speed=8.61x
video:1500kB audio:693kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.182632%
[libx264 # 0000021e37f15340] frame I:7 Avg QP:21.61 size: 18425
[libx264 # 0000021e37f15340] frame P:331 Avg QP:24.78 size: 3593
[libx264 # 0000021e37f15340] frame B:975 Avg QP:31.57 size: 223
[libx264 # 0000021e37f15340] consecutive B-frames: 0.8% 0.2% 1.6% 97.5%
[libx264 # 0000021e37f15340] mb I I16..4: 3.6% 31.1% 65.3%
[libx264 # 0000021e37f15340] mb P I16..4: 0.8% 1.3% 4.2% P16..4: 37.0% 29.0% 15.9% 0.0% 0.0% skip:11.7%
[libx264 # 0000021e37f15340] mb B I16..4: 0.0% 0.0% 0.2% B16..8: 8.4% 2.8% 1.2% direct: 0.4% skip:87.0% L0:61.8% L1:31.0% BI: 7.3%
[libx264 # 0000021e37f15340] 8x8 transform intra:22.3% inter:18.7%
[libx264 # 0000021e37f15340] coded y,uvDC,uvAC intra: 73.2% 85.7% 52.9% inter: 11.6% 7.4% 0.7%
[libx264 # 0000021e37f15340] i16 v,h,dc,p: 25% 33% 22% 19%
[libx264 # 0000021e37f15340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 28% 19% 4% 5% 4% 7% 5% 7%
[libx264 # 0000021e37f15340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 26% 13% 5% 7% 6% 7% 6% 7%
[libx264 # 0000021e37f15340] i8c dc,h,v,p: 38% 29% 22% 11%
[libx264 # 0000021e37f15340] Weighted P-Frames: Y:2.7% UV:0.3%
[libx264 # 0000021e37f15340] ref P L0: 86.1% 8.9% 3.6% 1.4% 0.1%
[libx264 # 0000021e37f15340] ref B L0: 94.7% 4.6% 0.8%
[libx264 # 0000021e37f15340] ref B L1: 99.3% 0.7%
[libx264 # 0000021e37f15340] kb/s:280.02
[aac # 0000021e3847c900] Qavg: 729.586
Related
What I'm going to do: I'd like to join a set of (46) images and a (1.8 second) mp3 file to a mp4 file.
What works: When I use ffmpeg -framerate 25 -i img%09d.bmp -i audio.mp3 -c:v libx264 -vf scale=1280:-2,format=yuv420p -c:a copy -movflags +faststart output.mp4 (more or less the statement from https://superuser.com/a/852252 ), then ffmpeg creates the mp4 file and everything is fine: there is audio and video in a player like VLC.
What does not work: When I use a framerate of 30 (instead of 25), VLC shows video only, but does not play audio.
Question: What can I do to get it to work with framerate 30 (even when there are not enough images to cover the whole mp3 duration)?
Additional information:
When I copy images so that there are 60 of them (2 seconds at framerate 30), then VLC plays the mp4 with audio and video.
When I add the -shortest option like this ffmpeg -framerate 30 -i img%09d.bmp -i audio.mp3 -c:v libx264 -vf scale=1280:-2,format=yuv420p -c:a copy -movflags +faststart -shortest output.mp4 then VLC plays only audio and not video.
This is how the output for framerate 30 looks like. It is nearly the same for framerate 25 (but "30" instead of "25" and some other durations/times/ids).
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, image2, from 'img%09d.bmp':
Duration: 00:00:01.57, start: 0.000000, bitrate: N/A
Stream #0:0: Video: bmp, bgr24, 480x480, 30 fps, 30 tbr, 30 tbn, 30 tbc
[mp3 # 0x5557d053efc0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio.mp3':
Duration: 00:00:01.03, start: 0.000000, bitrate: 32 kb/s
Stream #1:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[image2 # 0x5557d0536e00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[libx264 # 0x5557d0550340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x5557d0550340] profile High, level 4.0, 4:2:0, 8-bit
[libx264 # 0x5557d0550340] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - 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=4 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:
encoder : Lavf58.76.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1280x1280, q=2-31, 30 fps, 15360 tbn
Metadata:
encoder : Lavc58.134.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 32 kb/s
[mp4 # 0x5557d054f640] Starting second pass: moving the moov atom to the beginning of the file
frame= 47 fps= 15 q=-1.0 Lsize= 259kB time=00:00:01.46 bitrate=1446.3kbits/s speed=0.454x
video:253kB audio:4kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.892266%
[libx264 # 0x5557d0550340] frame I:1 Avg QP:18.97 size:186405
[libx264 # 0x5557d0550340] frame P:16 Avg QP:19.79 size: 2808
[libx264 # 0x5557d0550340] frame B:30 Avg QP:23.61 size: 889
[libx264 # 0x5557d0550340] consecutive B-frames: 4.3% 0.0% 95.7% 0.0%
[libx264 # 0x5557d0550340] mb I I16..4: 3.0% 82.4% 14.6%
[libx264 # 0x5557d0550340] mb P I16..4: 0.1% 0.3% 0.0% P16..4: 7.1% 1.2% 1.4% 0.0% 0.0% skip:90.0%
[libx264 # 0x5557d0550340] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 10.5% 0.2% 0.1% direct: 0.2% skip:89.0% L0:22.9% L1:75.6% BI: 1.5%
[libx264 # 0x5557d0550340] 8x8 transform intra:81.7% inter:83.0%
[libx264 # 0x5557d0550340] coded y,uvDC,uvAC intra: 90.3% 94.8% 82.0% inter: 0.8% 1.6% 0.2%
[libx264 # 0x5557d0550340] i16 v,h,dc,p: 0% 46% 4% 50%
[libx264 # 0x5557d0550340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 18% 10% 8% 9% 8% 10% 10% 14%
[libx264 # 0x5557d0550340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 14% 7% 8% 15% 11% 10% 9% 10%
[libx264 # 0x5557d0550340] i8c dc,h,v,p: 53% 20% 15% 11%
[libx264 # 0x5557d0550340] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x5557d0550340] ref P L0: 86.6% 3.5% 7.2% 2.7%
[libx264 # 0x5557d0550340] ref B L0: 79.9% 19.4% 0.7%
[libx264 # 0x5557d0550340] kb/s:1317.43
hi I am using ffmpeg xfade to concat two clips, the transition looks fine, but the second clip has no audio in the output. I don't find more information about this in https://trac.ffmpeg.org/wiki/Xfade and the official doc. Can I keep the audio of both clips in sync?
I'm puttting the complete log below, it's massive
ffmpeg -i teacher1.mp4 -i teacher2.mp4 -filter_complex xfade=transition=fadewhite:duration=1:offset=14.5 output.mp4
ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --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-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'teacher1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:00:15.02, start: 0.000000, bitrate: 2447 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2315 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'teacher2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:00:15.02, start: 0.000000, bitrate: 1643 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1509 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 (h264) -> xfade:main (graph 0)
Stream #1:0 (h264) -> xfade:xfade (graph 0)
xfade (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x64603c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x64603c0] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 # 0x64603c0] 264 - core 161 r3018 db0d417 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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=4 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 : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x1080, q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.91.100 aac
frame= 738 fps= 25 q=-1.0 Lsize= 7317kB time=00:00:29.40 bitrate=2038.9kbits/s speed=1.01x
video:7064kB audio:236kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.241368%
[libx264 # 0x64603c0] frame I:8 Avg QP:16.56 size:100307
[libx264 # 0x64603c0] frame P:332 Avg QP:19.50 size: 15211
[libx264 # 0x64603c0] frame B:398 Avg QP:24.35 size: 3467
[libx264 # 0x64603c0] consecutive B-frames: 6.2% 62.6% 8.9% 22.2%
[libx264 # 0x64603c0] mb I I16..4: 18.7% 60.5% 20.9%
[libx264 # 0x64603c0] mb P I16..4: 4.5% 7.6% 0.6% P16..4: 24.1% 5.6% 1.9% 0.0% 0.0% skip:55.7%
[libx264 # 0x64603c0] mb B I16..4: 0.4% 0.5% 0.1% B16..8: 14.3% 0.9% 0.1% direct: 0.4% skip:83.3% L0:42.9% L1:53.9% BI: 3.3%
[libx264 # 0x64603c0] 8x8 transform intra:59.2% inter:84.3%
[libx264 # 0x64603c0] coded y,u,v intra: 25.3% 11.9% 13.0% inter: 3.2% 1.7% 1.8%
[libx264 # 0x64603c0] i16 v,h,dc,p: 49% 25% 15% 12%
[libx264 # 0x64603c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 17% 37% 2% 2% 3% 2% 3% 2%
[libx264 # 0x64603c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 19% 15% 6% 7% 7% 6% 6% 5%
[libx264 # 0x64603c0] Weighted P-Frames: Y:3.3% UV:1.5%
[libx264 # 0x64603c0] ref P L0: 66.0% 8.0% 18.5% 7.5% 0.0%
[libx264 # 0x64603c0] ref B L0: 84.9% 13.1% 2.0%
[libx264 # 0x64603c0] ref B L1: 98.8% 1.2%
[libx264 # 0x64603c0] kb/s:1960.04
[aac # 0x64d1280] Qavg: 171.394
So have have the following FFmpeg command
ffmpeg -i vidab.mp4 -i recab.webm -filter_complex "[0:a]volume=0.2,apad[A];[1:a][A]amerge[Aout]" -map 0:v -map [Aout] -y mergeab.mp4
When the input files are played separately their audio is played equally through both headphones.
But after being merged the audio from the video is on the right side and the audio from the webm file is on the left side.
I see this in the output when I run the cmd
[Parsed_amerge_2 # 0x7fa0faf01bc0] No channel layout for input 1
[Parsed_amerge_2 # 0x7fa0faf01bc0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
How can I adjust this so that the output file has the audio from both the inputs in equally in the left and right sides?
Also is there a generic way to do this such that even different configurations (video has stereo and audio has mono ... or both have stereo) result in the Audio being split evenly.
I tried using the pan filter but there is something I am not understanding about how it works because either nothing happens or I flip left and right. But I am not getting even stereo.
fwiw here is the full output.
ffmpeg -i vidab.mp4 -i recab.webm -filter_complex "[0:a]volume=0.2,apad[A];[1:a][A]amerge[Aout]" -map 0:v -map [Aout] -y mergeab.mp4
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.8)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vidab.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2020-02-21T00:35:25.000000Z
Duration: 00:00:10.65, start: 0.000000, bitrate: 2539 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
Metadata:
creation_time : 2020-02-21T00:35:25.000000Z
handler_name : Core Media Audio
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x640, 2436 kb/s, 29.87 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2020-02-21T00:35:25.000000Z
handler_name : Core Media Video
encoder : H.264
Input #1, matroska,webm, from 'recab.webm':
Metadata:
encoder : opus-media-recorder
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #1:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream mapping:
Stream #0:0 (aac) -> volume (graph 0)
Stream #1:0 (opus) -> amerge:in0 (graph 0)
Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
amerge (graph 0) -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 # 0x7fa0fb004000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x7fa0fb004000] profile High, level 3.1
[libx264 # 0x7fa0fb004000] 264 - core 155 r2917 0a84d98 - 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=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
[Parsed_amerge_2 # 0x7fa0faf01bc0] No channel layout for input 1
[Parsed_amerge_2 # 0x7fa0faf01bc0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, mp4, to 'mergeab.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc, progressive), 1280x640, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
creation_time : 2020-02-21T00:35:25.000000Z
handler_name : Core Media Video
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.54.100 aac
frame= 318 fps=107 q=-1.0 Lsize= 1568kB time=00:00:17.72 bitrate= 724.8kbits/s speed=5.99x
video:1282kB audio:272kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.902630%
[libx264 # 0x7fa0fb004000] frame I:2 Avg QP:19.72 size: 51154
[libx264 # 0x7fa0fb004000] frame P:148 Avg QP:21.28 size: 6644
[libx264 # 0x7fa0fb004000] frame B:168 Avg QP:25.18 size: 1351
[libx264 # 0x7fa0fb004000] consecutive B-frames: 1.3% 84.9% 0.0% 13.8%
[libx264 # 0x7fa0fb004000] mb I I16..4: 23.2% 49.3% 27.5%
[libx264 # 0x7fa0fb004000] mb P I16..4: 2.1% 2.0% 0.2% P16..4: 29.0% 5.1% 4.8% 0.0% 0.0% skip:56.8%
[libx264 # 0x7fa0fb004000] mb B I16..4: 0.5% 0.3% 0.0% B16..8: 16.7% 0.8% 0.2% direct: 6.1% skip:75.4% L0:24.8% L1:71.1% BI: 4.1%
[libx264 # 0x7fa0fb004000] 8x8 transform intra:45.4% inter:74.3%
[libx264 # 0x7fa0fb004000] coded y,uvDC,uvAC intra: 29.3% 51.4% 11.6% inter: 5.7% 16.6% 0.3%
[libx264 # 0x7fa0fb004000] i16 v,h,dc,p: 11% 53% 10% 26%
[libx264 # 0x7fa0fb004000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 36% 35% 2% 2% 2% 4% 2% 3%
[libx264 # 0x7fa0fb004000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 30% 12% 4% 6% 5% 7% 5% 6%
[libx264 # 0x7fa0fb004000] i8c dc,h,v,p: 47% 33% 17% 4%
[libx264 # 0x7fa0fb004000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7fa0fb004000] ref P L0: 76.6% 7.6% 11.1% 4.7%
[libx264 # 0x7fa0fb004000] ref B L0: 89.1% 10.3% 0.6%
[libx264 # 0x7fa0fb004000] ref B L1: 99.7% 0.3%
[libx264 # 0x7fa0fb004000] kb/s:989.60
[aac # 0x7fa0fb005800] Qavg: 13376.354
Use amix instead of amerge and resample to stereo using -ac 2. Since you're mapping the first video, tell amix to terminate with first input.
ffmpeg -i vidab.mp4 -i recab.webm -filter_complex "[0:a]volume=0.2[A];[A][1:a]amix=inputs=2:duration=first[Aout]" -map 0:v -map [Aout] -y mergeab.mp4
I'm trying overlay audio onto a video. I have a very simple ffmpeg command (auido.mp3 is much longer than the video)
ffmpeg -i video.mp4 -i audio.mp3 -filter_complex "[0:a] [1:a] amix=duration=shortest [a]" -map 0:v -map [a] test.mp4
This produces a silent video. However, when not mapping the video stream
ffmpeg -i video.mp4 -i audio.mp3 -filter_complex "[0:a] [1:a] amix=duration=shortest [a]" -map [a] test.mp4
The resulting audio file is as expected.
What could be causing this issues?
(Is there a better way to overlay audio onto a video via ffmpeg?)
Edit: log
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2019-11-15T05:28:05.000000Z
Duration: 00:00:00.53, start: 0.000000, bitrate: 9463 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 9546 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default)
Metadata:
creation_time : 2019-11-15T05:28:05.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : AVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2019-11-15T05:28:05.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
[mp3 # 000001fdf5f7f040] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio.mp3':
Metadata:
date : 2019-11-14 23:31
id3v2_priv.XMP : <?xpacket begin="\xef\xbb\xbf" id="W5M0MpCehiHzreSzNTczkc9d"?>\x0a<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c148 79.163765, 2019/01/24-18:11:46 ">\x0a <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\x0a <rdf
Duration: 00:22:01.91, start: 0.000000, bitrate: 256 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 256 kb/s
Stream mapping:
Stream #0:1 (aac) -> amix:input0 (graph 0)
Stream #1:0 (mp3float) -> amix:input1 (graph 0)
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
amix (graph 0) -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 # 000001fdf64ab700] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 000001fdf64ab700] profile High, level 4.0, 4:2:0, 8-bit
[libx264 # 000001fdf64ab700] 264 - core 158 r2984 3759fcb - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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 'test.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf58.29.100
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
creation_time : 2019-11-15T05:28:05.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.54.100 aac
frame= 15 fps=0.0 q=-1.0 Lsize= 695kB time=00:00:00.40 bitrate=14232.7kbits/s speed=0.437x
video:693kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.226150%
[libx264 # 000001fdf64ab700] frame I:1 Avg QP:30.52 size:101545
[libx264 # 000001fdf64ab700] frame P:7 Avg QP:28.22 size: 44755
[libx264 # 000001fdf64ab700] frame B:7 Avg QP:30.76 size: 42074
[libx264 # 000001fdf64ab700] consecutive B-frames: 20.0% 40.0% 40.0% 0.0%
[libx264 # 000001fdf64ab700] mb I I16..4: 68.3% 10.5% 21.2%
[libx264 # 000001fdf64ab700] mb P I16..4: 17.6% 4.8% 4.3% P16..4: 28.5% 4.5% 2.8% 0.0% 0.0% skip:37.6%
[libx264 # 000001fdf64ab700] mb B I16..4: 17.6% 2.4% 1.3% B16..8: 37.9% 6.7% 1.3% direct: 4.9% skip:27.8% L0:40.5% L1:54.3% BI: 5.2%
[libx264 # 000001fdf64ab700] 8x8 transform intra:13.9% inter:59.5%
[libx264 # 000001fdf64ab700] coded y,uvDC,uvAC intra: 54.5% 53.3% 42.3% inter: 15.3% 27.8% 21.6%
[libx264 # 000001fdf64ab700] i16 v,h,dc,p: 5% 88% 5% 2%
[libx264 # 000001fdf64ab700] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 53% 29% 1% 1% 1% 2% 1% 2%
[libx264 # 000001fdf64ab700] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 80% 9% 1% 1% 0% 1% 0% 2%
[libx264 # 000001fdf64ab700] i8c dc,h,v,p: 16% 80% 3% 1%
[libx264 # 000001fdf64ab700] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 000001fdf64ab700] ref P L0: 40.3% 4.9% 11.0% 43.8%
[libx264 # 000001fdf64ab700] ref B L0: 80.0% 11.1% 8.9%
[libx264 # 000001fdf64ab700] kb/s:11349.57
[aac # 000001fdf64ac600] Qavg: 41522.195
I have a bunch of images PNG files. I'm trying to make a slideshow with these using ffmpeg. The images are 3000*4000. These images don't have all the same aspect ratio.
Some are like these :
Some are like this :
I used the command :
ffmpeg -loop 1 -framerate 1/10 -i img%3d.png -i audio.wav -vf scale=w=3840:h=-1 -vcodec libx264 -crf 14 -r 60 -pix_fmt yuv420p -shortest output.mp4
It returns me this :
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-mips32r2 --disable-mips32r6 --disable-mips64r6 --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-libopencv --disable-podpages --disable-stripping --enable-avfilter --enable-avresample --enable-gcrypt --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libzvbi --enable-nonfree --enable-opengl --enable-openssl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-frei0r --enable-chromaprint --enable-libx264 --enable-libiec61883 --enable-libdc1394 --enable-vaapi --disable-opencl --enable-libmfx --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, image2, from 'img%3d.png':
Duration: 00:02:30.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 4000x3000 [SAR 7087:7087 DAR 4:3], 0.10 tbr, 0.10 tbn, 0.10 tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from 'audio.wav':
Duration: 01:54:44.14, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x55c1be935420] using SAR=1/1
[libx264 # 0x55c1be935420] frame MB size (240x180) > level limit (36864)
[libx264 # 0x55c1be935420] MB rate (2592000) > level limit (2073600)
[libx264 # 0x55c1be935420] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x55c1be935420] profile High, level 5.2
[libx264 # 0x55c1be935420] 264 - core 150 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=14.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:
encoder : Lavf57.71.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 3840x2880 [SAR 1:1 DAR 4:3], q=-1--1, 60 fps, 15360 tbn, 60 tbc
Metadata:
encoder : Lavc57.89.100 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), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.89.100 aac
[image2 # 0x55c1be8edde0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
More than 1000 frames duplicated 5309kB time=00:00:09.13 bitrate=4762.0kbits/s dup=599 drop=0 speed=0.164x
More than 10000 frames duplicated 137722kB time=00:02:39.13 bitrate=7089.8kbits/s dup=9584 drop=0 speed=0.174x
More than 100000 frames duplicated429964kB time=00:27:39.13 bitrate=7060.5kbits/s dup=99434 drop=0 speed=0.173x
frame=413401 fps= 10 q=-1.0 Lsize= 5962186kB time=01:54:49.96 bitrate=7088.9kbits/s dup=413310 drop=0 speed=0.173x
video:5831116kB audio:117825kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.222641%
[libx264 # 0x55c1be935420] frame I:2068 Avg QP: 6.65 size:2816521
[libx264 # 0x55c1be935420] frame P:104040 Avg QP:10.85 size: 470
[libx264 # 0x55c1be935420] frame B:307293 Avg QP:16.51 size: 318
[libx264 # 0x55c1be935420] consecutive B-frames: 0.8% 0.0% 0.5% 98.7%
[libx264 # 0x55c1be935420] mb I I16..4: 7.3% 54.6% 38.1%
[libx264 # 0x55c1be935420] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.8%
[libx264 # 0x55c1be935420] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0% L0:49.5% L1:50.5% BI: 0.0%
[libx264 # 0x55c1be935420] 8x8 transform intra:54.6% inter:97.9%
[libx264 # 0x55c1be935420] coded y,uvDC,uvAC intra: 98.2% 92.7% 92.2% inter: 0.0% 0.0% 0.0%
[libx264 # 0x55c1be935420] i16 v,h,dc,p: 17% 12% 36% 35%
[libx264 # 0x55c1be935420] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 26% 13% 5% 6% 6% 9% 6% 11%
[libx264 # 0x55c1be935420] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 24% 11% 7% 9% 7% 10% 7% 11%
[libx264 # 0x55c1be935420] i8c dc,h,v,p: 40% 33% 18% 10%
[libx264 # 0x55c1be935420] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x55c1be935420] ref P L0: 99.6% 0.0% 0.4% 0.0%
[libx264 # 0x55c1be935420] ref B L0: 21.9% 78.1% 0.0%
[libx264 # 0x55c1be935420] ref B L1: 99.5% 0.5%
[libx264 # 0x55c1be935420] kb/s:6933.00
[aac # 0x55c1be938aa0] Qavg: 640.546
But the second image is distorted in the video (I can't show you because I don't have enough reputation to post more links).
So I would like to preserve the aspect ratio of each picture : the images shouldn't be distorted. What command should I use for this ?
Thanks in advance.
Looks like the input resolution is fixed but the orientation varies.
Use
ffmpeg -framerate 1/10 -i img%3d.png -i audio.wav \
-vf 'scale=3840:2880:force_original_aspect_ratio=decrease,pad=3840:2880:(ow-iw)/2:(oh-ih)/2,setsar=1' \
-c:v libx264 -crf 14 -r 25 -pix_fmt yuv420p -shortest output.mp4
(Since this is a slideshow, there's absolutely no point to encode at 60 fps.)