[FFmpeg-user] Using several audios after each-other in a video
Cecil Westerhof
Cecil at decebal.nl
Thu Jun 16 14:11:06 EEST 2022
At the moment I am making a slideshow like the following:
zoompan=zoompan=d=3:fps=.333:s=1280x960,framerate=25:interp_start=0:interp_end=255:scene=100
ffmpeg -y \
-i %03d.jpg \
-i ${audio} \
-to $to \
-vf ${zoompan} \
-pix_fmt yuv420p \
${outputFile}
Until now I found audios that had the right length, but now I need to
put several audios together for the generated video.
I could create an audio from several audios every time.
A slightly better option would be a variant of:
-itsoffset 10 -i audio1.mp3 -itsoffset 15 -i audio2.mp3
But is there a way to just let the audios be put after each-other?
This does not work:
-i ${audio1} \
-i ${audio2} \
I only get the first audio.
But the same happens with -itsoffset I am afraid.
I used:
ffmpeg -y -i %03d.jpg -i /home/cecil/Audio/YouTube/Habanera_by_Bizet.mp3 -itsoffset 120 -i /home/cecil/Audio/YouTube/Wedding_Invitation.mp3 -vf zoompan=d=3:fps=.333:s=1280x960,framerate=25:interp_start=0:interp_end=255:scene=100 -pix_fmt yuv420p sander2.mp4
I only here the first audio.
Output from ffmpeg:
ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-li
nux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avr
esample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enabl
e-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --ena
ble-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-lib
gsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --en
able-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libs
hine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libth
eora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --ena
ble-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-
lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --en
able-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r
--enable-libx264 --enable-shared
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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, image2, from '%03d.jpg':
Duration: 00:00:02.20, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x960 [SAR 180:180 DA
R 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, mp3, from '/home/cecil/Audio/YouTube/Habanera_by_Bizet.mp3':
Metadata:
title : Habanera (by Bizet)
genre : Classical
artist : Bizet
album : YouTube Audio Library
encoder : Lavf55.19.104
Duration: 00:02:00.03, start: 0.025057, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Input #2, mp3, from '/home/cecil/Audio/YouTube/Wedding_Invitation.mp3':
Metadata:
title : Wedding Invitation
genre : Classical
artist : Jason Farnham
album : YouTube Audio Library
encoder : Lavf55.19.104
Duration: 00:01:41.04, start: 0.025057, bitrate: 128 kb/s
Stream #2:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[Parsed_framerate_1 @ 0x55ce83782240] time base:1000/333 -> 1/8325 exact:1
[Parsed_framerate_1 @ 0x55ce83782240] fps -> fps:25/1 scene score:100.000000 interpolate start:0 end:255
[swscaler @ 0x55ce8378a240] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55ce838f8c00] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x55ce8345ab40] using SAR=1/1
[libx264 @ 0x55ce8345ab40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1
[libx264 @ 0x55ce8345ab40] profile High, level 3.2, 4:2:0, 8-bit
[libx264 @ 0x55ce8345ab40] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - h
ttp://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_p
skip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bl
uray_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 q
comp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'sander2.mp4':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc
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: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.91.100 aac
[swscaler @ 0x55ce83cb8ec0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55ce840a0900] deprecated pixel format used, make sure you did set range correctly
[image2 @ 0x55ce8343e0c0] Thread message queue blocking; consider raising the thread_queue_size option (c
urrent value: 8)
[swscaler @ 0x55ce84215400] deprecated pixel format used, make sure you did set range correctly
.
.
.
frame=12388 fps= 27 q=-1.0 Lsize= 86187kB time=00:08:15.40 bitrate=1425.2kbits/s speed=1.08x
video:84124kB audio:1878kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.214622%
[libx264 @ 0x55ce8345ab40] frame I:50 Avg QP:16.28 size:315675
[libx264 @ 0x55ce8345ab40] frame P:5756 Avg QP:20.62 size: 12073
[libx264 @ 0x55ce8345ab40] frame B:6582 Avg QP:22.45 size: 131
[libx264 @ 0x55ce8345ab40] consecutive B-frames: 28.2% 2.4% 1.7% 67.7%
[libx264 @ 0x55ce8345ab40] mb I I16..4: 11.1% 59.1% 29.8%
[libx264 @ 0x55ce8345ab40] mb P I16..4: 0.1% 0.3% 0.0% P16..4: 31.9% 4.1% 7.0% 0.0% 0.0% skip
:56.6%
[libx264 @ 0x55ce8345ab40] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 2.4% 0.0% 0.0% direct: 0.0% skip
:97.6% L0:13.0% L1:85.8% BI: 1.2%
[libx264 @ 0x55ce8345ab40] 8x8 transform intra:65.0% inter:61.4%
[libx264 @ 0x55ce8345ab40] coded y,uvDC,uvAC intra: 66.5% 70.1% 56.9% inter: 10.3% 11.4% 2.1%
[libx264 @ 0x55ce8345ab40] i16 v,h,dc,p: 65% 10% 7% 19%
[libx264 @ 0x55ce8345ab40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 17% 24% 6% 6% 6% 8% 7% 9%
[libx264 @ 0x55ce8345ab40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 17% 9% 8% 10% 9% 11% 10% 12%
[libx264 @ 0x55ce8345ab40] i8c dc,h,v,p: 60% 18% 13% 8%
[libx264 @ 0x55ce8345ab40] Weighted P-Frames: Y:10.7% UV:7.2%
[libx264 @ 0x55ce8345ab40] ref P L0: 68.7% 25.7% 5.3% 0.3% 0.0%
[libx264 @ 0x55ce8345ab40] ref B L0: 92.4% 7.1% 0.5%
[libx264 @ 0x55ce8345ab40] ref B L1: 89.3% 10.7%
[libx264 @ 0x55ce8345ab40] kb/s:1390.74
[aac @ 0x55ce8347e7c0] Qavg: 533.159
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
More information about the ffmpeg-user
mailing list