Here is my png.txt file:
file '01.png'
duration 92
file '02.png'
duration 46
file '03.png'
duration 67
file '04.png'
duration 62
file '05.png'
duration 57
file '06.png'
duration 3
file '06.png'
mp3 duration = 00:05:28 (total of above)
And here is the line:
ffmpeg -f concat -i png.txt -vsync vfr -i 20170817.mp3 -c:a aac -s 1280x720 -c:v libx264 -pix_fmt yuv420p -shortest 20170817.mp4
And here is the output:
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.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. 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, concat, from 'png.txt':
Duration: 00:05:27.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: png, rgba(pc), 1280x720 [SAR 2835:2835 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, mp3, from '20170817.mp3':
Metadata:
encoder : Lavf57.71.100
Duration: 00:05:28.10, start: 0.069063, bitrate: 24 kb/s
Stream #1:0: Audio: mp3, 16000 Hz, mono, s16p, 24 kb/s
File '20170817.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x7fbe83003000] using SAR=1/1
[libx264 # 0x7fbe83003000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x7fbe83003000] profile High, level 3.1
[libx264 # 0x7fbe83003000] 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=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 '20170817.mp4':
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 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), 16000 Hz, mono, fltp, 69 kb/s
Metadata:
encoder : Lavc57.89.100 aac
frame= 7 fps=4.2 q=-1.0 Lsize= 3349kB time=00:05:27.04 bitrate= 83.9kbits/s speed= 196x
video:465kB audio:2863kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.644585%
[libx264 # 0x7fbe83003000] frame I:1 Avg QP: 7.93 size:159157
[libx264 # 0x7fbe83003000] frame P:2 Avg QP:17.16 size: 61998
[libx264 # 0x7fbe83003000] frame B:4 Avg QP:18.34 size: 48049
[libx264 # 0x7fbe83003000] consecutive B-frames: 14.3% 28.6% 0.0% 57.1%
[libx264 # 0x7fbe83003000] mb I I16..4: 48.6% 21.6% 29.8%
[libx264 # 0x7fbe83003000] mb P I16..4: 4.4% 9.8% 19.7% P16..4: 11.6% 3.0% 2.6% 0.0% 0.0% skip:48.9%
[libx264 # 0x7fbe83003000] mb B I16..4: 0.4% 0.5% 13.2% B16..8: 14.9% 3.9% 2.6% direct: 1.1% skip:63.4% L0:45.0% L1:52.1% BI: 3.0%
[libx264 # 0x7fbe83003000] 8x8 transform intra:19.2% inter:38.3%
[libx264 # 0x7fbe83003000] coded y,uvDC,uvAC intra: 52.3% 63.3% 62.4% inter: 8.6% 7.7% 6.9%
[libx264 # 0x7fbe83003000] i16 v,h,dc,p: 88% 9% 3% 0%
[libx264 # 0x7fbe83003000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 12% 45% 2% 2% 3% 2% 3% 4%
[libx264 # 0x7fbe83003000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 26% 18% 5% 5% 5% 5% 6% 6%
[libx264 # 0x7fbe83003000] i8c dc,h,v,p: 55% 18% 20% 8%
[libx264 # 0x7fbe83003000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7fbe83003000] ref P L0: 93.3% 0.3% 3.7% 2.8%
[libx264 # 0x7fbe83003000] ref B L0: 85.2% 14.8%
[libx264 # 0x7fbe83003000] ref B L1: 87.8% 12.2%
[libx264 # 0x7fbe83003000] kb/s:11.52
[aac # 0x7fbe83004800] Qavg: 1971.172
The problem is that the mp4 has 00:06:45 duration, and the music finished at 00:05:28
How do I chop the last silent bit off?
I tried the following:
ffmpeg -ss 0 -i 20170817.mp4 -to 00:05:28 -c copy cut.mp4
Which is worse. Adds blank silent video at front, and chop the video at middle which yet to finish.
Please note the first 5 images are correct at right music positions, only last image duration error
After running into the same extra silence at the end, it seems that explicitly limiting the video length using an output option (-to or -t) does the job. (You can use ss, -to, and -t as input or output options).
I had a similar setup to your question, albeit I took a 10-second slice of an audio file and used the concat filter to overlay it with 4 images.
# files.ffconcat
file 'image1.png'
duration 1
file 'image2.png'
duration 4
file 'image3.png'
duration 3
file 'image4.png'
duration 2
ffmpeg \
-t 10 \
-i song.mp3 \
-i files.ffconcat \
-pix_fmt yuv420p \
video.mp4
Though 1 + 4 + 3 + 2 = 10 seconds, the final video had a length of 10.84s with silence at the end, as you have observed:
frame= 274 fps= 17 q=-1.0 Lsize= 1013kB time=00:00:10.84 bitrate= 765.2kbits/s dup=343 drop=0 speed=0.683x
However, adding -t 10 as an output option
ffmpeg \
-t 10 \
-i song.mp3 \
-i files.ffconcat \
-pix_fmt yuv420p \
-t 10 \
video.mp4
results in a video which is exactly 10 seconds:
frame= 250 fps= 31 q=-1.0 Lsize= 1002kB time=00:00:10.00 bitrate= 820.0kbits/s dup=343 drop=0 speed=1.25x
Strange Aside
Interestingly enough, if the time durations for each image are 2.5 seconds, the final video does not need this workaround to be exactly 10 seconds:
# files.ffconcat
file 'image1.png'
duration 2.5
file 'image2.png'
duration 2.5
file 'image3.png'
duration 2.5
file 'image4.png'
duration 2.5
ffmpeg \
-t 10 \
-i song.mp3 \
-i files.ffconcat \
-pix_fmt yuv420p \
-t 10 \
video.mp4
frame= 250 fps= 30 q=-1.0 Lsize= 1000kB time=00:00:10.00 bitrate= 818.4kbits/s dup=307 drop=0 speed= 1.2x
This is something I was not able to figure out. But for anyone curious, here's the ffmpeg -version:
ffmpeg version 4.0.1-tessus Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Related
I've tried this:
"C:\Program Files\ffmpeg-4.2.1-win64-static\bin\ffmpeg" -i %1 -i %2 -b:v 1M -y -speed 2 "%~dpn1.mp4"
"C:\Program Files\ffmpeg-4.2.1-win64-static\bin\ffmpeg" -i %1 -i %2 -pix_fmt yuv420p -vcodec libx264 -async 1 -speed 2 "%~dpn1.mp4"
Always same result. The file and quality are great, but obv since its karaoke... the lyrics need to match the timing and the converted files lyrics track is always about a full second or so ahead from when I play the original in a Karaoke program. Any ideas on what settings I could play with to help with this?
Both the original and the converted have the same play length at the end though. so the mp3 track seems to be ok.
EDIT: Added cmd output
"C:\Program Files\ffmpeg-4.2.1-win64-static\bin\ffmpeg" -i "A:\25 Karaoke\English\Linkin Park - In The End [SF Karaoke].cdg" -i "A:\25 Karaoke\English\Linkin Park - In The End [SF Karaoke].mp3" -b:v 1M -y -speed 2 "LP_inTheEnd.mp4"
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, cdg, from 'A:\25 Karaoke\English\Linkin Park - In The End [SF Karaoke].cdg':
Duration: 00:03:56.21, start: 0.480000, bitrate: 57 kb/s
Stream #0:0: Video: cdgraphics, pal8, 300x216, 300 fps, 300 tbr, 300 tbn, 300 tbc
[mp3 # 000001bb3c14bb40] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'A:\25 Karaoke\English\Linkin Park - In The End [SF Karaoke].mp3':
Metadata:
title : In The End [SF Karaoke]
artist : Linkin Park
comment : http://www.otslabs.com/
Duration: 00:03:56.26, start: 0.000000, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Codec AVOption speed () specified for output file #0 (LP_inTheEnd.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
Stream #0:0 -> #0:0 (cdgraphics (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 000001bb3c13bc00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 000001bb3c13bc00] profile High 4:4:4 Predictive, level 3.1, 4:4:4, 8-bit
[libx264 # 000001bb3c13bc00] 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=4 threads=7 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=abr mbtree=1 bitrate=1000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'LP_inTheEnd.mp4':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p(progressive), 300x216, q=-1--1, 1000 kb/s, 300 fps, 19200 tbn, 300 tbc
Metadata:
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.54.100 aac
More than 1000 frames duplicated
More than 10000 frames duplicated 2048kB time=00:00:42.16 bitrate= 397.9kbits/s dup=9625 drop=0 speed=11.5x
frame=59170 fps=3226 q=-1.0 Lsize= 11887kB time=00:03:56.26 bitrate= 412.2kbits/s dup=43525 drop=0 speed=12.9x
video:7749kB audio:3340kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.203599%
[libx264 # 000001bb3c13bc00] frame I:242 Avg QP: 0.26 size: 17214
[libx264 # 000001bb3c13bc00] frame P:16651 Avg QP: 0.14 size: 164
[libx264 # 000001bb3c13bc00] frame B:42277 Avg QP: 0.25 size: 25
[libx264 # 000001bb3c13bc00] consecutive B-frames: 2.7% 4.9% 3.8% 88.6%
[libx264 # 000001bb3c13bc00] mb I I16..4: 73.7% 1.6% 24.7%
[libx264 # 000001bb3c13bc00] mb P I16..4: 0.1% 0.0% 0.1% P16..4: 0.4% 0.0% 0.0% 0.0% 0.0% skip:99.4%
[libx264 # 000001bb3c13bc00] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0% 0.0% direct: 0.0% skip:99.7% L0:44.2% L1:55.6% BI: 0.2%
[libx264 # 000001bb3c13bc00] final ratefactor: -19.48
[libx264 # 000001bb3c13bc00] 8x8 transform intra:1.5% inter:14.0%
[libx264 # 000001bb3c13bc00] coded y,u,v intra: 14.1% 14.8% 14.9% inter: 0.0% 0.0% 0.0%
[libx264 # 000001bb3c13bc00] i16 v,h,dc,p: 90% 0% 9% 0%
[libx264 # 000001bb3c13bc00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 14% 63% 0% 0% 0% 0% 0% 1%
[libx264 # 000001bb3c13bc00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 55% 15% 16% 1% 2% 3% 3% 2% 2%
[libx264 # 000001bb3c13bc00] Weighted P-Frames: Y:0.2% UV:0.2%
[libx264 # 000001bb3c13bc00] ref P L0: 97.9% 0.9% 1.0% 0.2%
[libx264 # 000001bb3c13bc00] ref B L0: 99.6% 0.4% 0.0%
[libx264 # 000001bb3c13bc00] ref B L1: 99.9% 0.1%
[libx264 # 000001bb3c13bc00] kb/s:321.80
[aac # 000001bb3c172e40] Qavg: 6813.878
try:
ffmpeg -itsoffset 1 -i "Linkin Park - In The End [SF Karaoke].cdg" -itsoffset 0 -i "Linkin Park - In The End [SF Karaoke].mp3" -b:v 1M -y -speed 2 "LP_inTheEnd.mp4"
that's your original command (though without the windows-specific bits) adjusted with a timestamp offset of 1 on the video and zero on the audio, so that the video should delay one second but the audio should not.
My source for inputs into FFmpeg is either one AVI file or a concat of many of them. Either way my resulting timelapse file has a long tail of frames that are a repeat of a single frame. It's like a very long freeze frame is resulting on the end of my output file.
I'm on an older Mac Pro so I can't update my FFmpeg. I have a laptop that has a newer version and I get the same there as well. I'm not sure if it's because my source files are AVI or not.
ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --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-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-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[avi # 0x7fa82080c800] sample size (1) != block align (2)
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'concat:16460001.AVI|16460002.AVI|16460003.AVI|16460004.AVI|16460005.AVI|16460006.AVI|16460007.AVI|16460008.AVI|16460009.AVI|16460010.AVI|16460011.AVI|16460012.AVI|16460013.AVI|16460014.AVI|16460015.AVI|16460016.AVI|16460017.AVI|16460018.AVI|16460019.AVI|16460020.AVI|16460021.AVI':
Duration: 00:10:02.00, start: 0.000000, bitrate: 365923 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, mono, s16, 512 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x7fa82082cc00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 # 0x7fa82082cc00] profile High, level 3.1
[libx264 # 0x7fa82082cc00] 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=16 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 'out.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc, progressive), 1280x720, q=-1--1, 16 fps, 16384 tbn, 16 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: Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 69 kb/s
Metadata:
encoder : Lavc58.35.100 aac
frame= 1962 fps=1.2 q=-1.0 Lsize= 136725kB time=03:24:07.00 bitrate= 91.5kbits/s dup=0 drop=365448 speed=7.41x
video:31548kB audio:103624kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.149437%
[libx264 # 0x7fa82082cc00] frame I:10 Avg QP:18.74 size: 62176
[libx264 # 0x7fa82082cc00] frame P:514 Avg QP:21.24 size: 30528
[libx264 # 0x7fa82082cc00] frame B:1438 Avg QP:22.74 size: 11121
[libx264 # 0x7fa82082cc00] consecutive B-frames: 1.4% 2.0% 2.0% 94.6%
[libx264 # 0x7fa82082cc00] mb I I16..4: 2.1% 97.2% 0.7%
[libx264 # 0x7fa82082cc00] mb P I16..4: 2.0% 33.3% 0.1% P16..4: 37.7% 12.0% 10.4% 0.0% 0.0% skip: 4.5%
[libx264 # 0x7fa82082cc00] mb B I16..4: 0.7% 11.5% 0.0% B16..8: 29.1% 4.8% 1.3% direct:12.0% skip:40.6% L0:47.5% L1:42.9% BI: 9.6%
[libx264 # 0x7fa82082cc00] 8x8 transform intra:94.3% inter:83.0%
[libx264 # 0x7fa82082cc00] coded y,uvDC,uvAC intra: 73.4% 66.7% 8.5% inter: 25.9% 46.8% 2.2%
[libx264 # 0x7fa82082cc00] i16 v,h,dc,p: 17% 33% 26% 24%
[libx264 # 0x7fa82082cc00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 23% 51% 1% 2% 1% 4% 1% 2%
[libx264 # 0x7fa82082cc00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 21% 19% 5% 8% 7% 13% 5% 5%
[libx264 # 0x7fa82082cc00] i8c dc,h,v,p: 46% 29% 23% 2%
[libx264 # 0x7fa82082cc00] Weighted P-Frames: Y:47.5% UV:19.3%
[libx264 # 0x7fa82082cc00] ref P L0: 45.0% 13.8% 20.6% 15.7% 5.0%
[libx264 # 0x7fa82082cc00] ref B L0: 61.1% 30.4% 8.5%
[libx264 # 0x7fa82082cc00] ref B L1: 85.8% 14.2%
[libx264 # 0x7fa82082cc00] kb/s:2107.54
[aac # 0x7fa82081ea00] Qavg: 130.084
I've read this thread and tried to follow it:
Create time lapse video from other video
Here are some trials I've attempted before, all with the same output:
# ffmpeg -y -i $mov -vf framestep=10,setpts=N/FRAME_RATE/TB,fps=2 -r 30 $out
# ffmpeg -y -i $mov -vf framestep=10,setpts=.01*PTS -r 30 $out
# ffmpeg -y -i $mov -vf framestep=10,setpts=.1*PTS -r 30 $out
# ffmpeg -y -i "concat:16460001.AVI|16460002.AVI|16460003.AVI|16460004.AVI|16460005.AVI|16460006.AVI|16460007.AVI|16460008.AVI|16460009.AVI|16460010.AVI|16460011.AVI|16460012.AVI|16460013.AVI|16460014.AVI|16460015.AVI|16460016.AVI|16460017.AVI|16460018.AVI|16460019.AVI|16460020.AVI|16460021.AVI" -vf framestep=10,setpts=.05*PTS -r 30 $out
ffmpeg -y -i "concat:16460001.AVI|16460002.AVI|16460003.AVI|16460004.AVI|16460005.AVI|16460006.AVI|16460007.AVI|16460008.AVI|16460009.AVI|16460010.AVI|16460011.AVI|16460012.AVI|16460013.AVI|16460014.AVI|16460015.AVI|16460016.AVI|16460017.AVI|16460018.AVI|16460019.AVI|16460020.AVI|16460021.AVI" -r 16 -filter:v "setpts=0.01*PTS" out.mp4
Am I overlooking something? I'm trying to speed up the inputs into a single file to quickly review incoming security footage. How can I do this without the super long useless tail at the end?
Use
ffmpeg -i 16460021.AVI -vf framestep=15,setpts=N/30/TB -r 30 -an out.mp4
I get an output 1/15th the length of the original. When using framestep=X, setpts should be of the form N/X/TB if you wish to avoid frame duplication. Don't use fps when compressing video duration as it uses old stream duration from before compression (a bug). Skip audio, since that will result in original length.
This question already has answers here:
FFmpeg filter_complex concat gives only first input on crop
(1 answer)
Problems building Image slideshow with sliding transition using ffmpeg
(1 answer)
ffmpeg: chain of multiple filter_complex, re-using intermediate output stream
(1 answer)
Closed 3 years ago.
I'm attempting to scale and blur (sections of) a video with ffmpeg complex filters. This has actually been working in production for years.
I'm now running a newer build of ffmpeg on Ubuntu 18.04 and getting an error relating to the filters where the same command works fine on Ubuntu 16.04's ffmpeg against the same video.
Specifically, I'm seeing the following error:
mov,mp4,m4a,3gp,3g2,mj2 # 0x56055a5902c0] Invalid stream specifier: vs0.
Last message repeated 1 times
Stream specifier 'vs0' in filtergraph description ... matches no streams.
Has something about the complex filter API changed that would make this same input invalid in a newer version of ffmpeg?
The command in question is just running the following in a Bash terminal.
ffmpeg -ss 60 -i ~/test.mp4 -y -filter_complex "[0:v]scale=-2:'min(320,ih)'[vs0];[vs0]crop=in_w/9:in_h/2:0:0,boxblur=5:1:cr=3:ar=3[b0];[vs0]crop=in_w/9:in_h/2:in_w-out_w:0,boxblur=5:1:cr=3:ar=3[b1];[vs0]crop=(in_w-2*in_w/9):in_h/20:in_w/9:0,boxblur=5:1:cr=3:ar=3[b2];[vs0][b0]overlay=0:0[ovr0];[ovr0][b1]overlay=main_w-overlay_w:0[ovr1];[ovr1][b2]overlay=main_w/9:0[vs1]" -map [vs1] -an -ac 2 -b:a 128k -acodec aac -b:v 1024k -r 30 -vcodec libx264 -t 300 -y -preset slow -movflags faststart -pix_fmt yuv420p -f mp4 ~/out.mp4
If we break up the complex filter statement, it looks like:
[0:v]scale=-2:'min(320,ih)'[vs0];
[vs0]crop=in_w/9:in_h/2:0:0,boxblur=5:1:cr=3:ar=3[b0];
[vs0]crop=in_w/9:in_h/2:in_w-out_w:0,boxblur=5:1:cr=3:ar=3[b1];
[vs0]crop=(in_w-2*in_w/9):in_h/20:in_w/9:0,boxblur=5:1:cr=3:ar=3[b2];
[vs0][b0]overlay=0:0[ovr0];[ovr0][b1]overlay=main_w-overlay_w:0[ovr1];
[ovr1][b2]overlay=main_w/9:0[vs1]
On ffmpeg version N-86980-g62b7553 (Ubuntu 16.04), everything works great as it has done for years.
$ ffmpeg -ss 60 -i ~/test.mp4 -y -filter_complex "[0:v]scale=-2:'min(320,ih)'[vs0];[vs0]crop=in_w/9:in_h/2:0:0,boxblur=5:1:cr=3:ar=3[b0];[vs0]crop=in_w/9:in_h/2:in_w-out_w:0,boxblur=5:1:cr=3:ar=3[b1];[vs0]crop=(in_w-2*in_w/9):in_h/20:in_w/9:0,boxblur=5:1:cr=3:ar=3[b2];[vs0][b0]overlay=0:0[ovr0];[ovr0][b1]overlay=main_w-overlay_w:0[ovr1];[ovr1][b2]overlay=main_w/9:0[vs1]" -map [vs1] -an -ac 2 -b:a 128k -acodec aac -b:v 1024k -r 30 -vcodec libx264 -t 300 -y -preset slow -movflags faststart -pix_fmt yuv420p -f mp4 ~/out.mp4
ffmpeg version N-86980-g62b7553 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-nonfree
libavutil 55. 73.100 / 55. 73.100
libavcodec 57.102.100 / 57.102.100
libavformat 57. 76.100 / 57. 76.100
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 98.100 / 6. 98.100
libswscale 4. 7.102 / 4. 7.102
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/cmaier/test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.76.100
Duration: 00:10:00.00, start: 0.000000, bitrate: 1036 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 768x480, 1033 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 (h264) -> scale
Stream #0:0 (h264) -> crop
Stream #0:0 (h264) -> crop
Stream #0:0 (h264) -> overlay:main
overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 # 0x27b2ca0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x27b2ca0] profile High, level 3.1
[libx264 # 0x27b2ca0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=1024 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/home/cmaier/out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.76.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 768x480, q=-1--1, 1024 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc57.102.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/1024000 buffer size: 0 vbv_delay: -1
[mp4 # 0x27b5a60] Starting second pass: moving the moov atom to the beginning of the file3.9x
frame= 9000 fps=117 q=-1.0 Lsize= 37827kB time=00:04:59.90 bitrate=1033.3kbits/s speed= 3.9x
video:37721kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.282333%
[libx264 # 0x27b2ca0] frame I:36 Avg QP:15.21 size: 50944
[libx264 # 0x27b2ca0] frame P:2723 Avg QP:20.12 size: 9593
[libx264 # 0x27b2ca0] frame B:6241 Avg QP:24.23 size: 1710
[libx264 # 0x27b2ca0] consecutive B-frames: 3.6% 6.9% 14.5% 75.0%
[libx264 # 0x27b2ca0] mb I I16..4: 17.3% 58.5% 24.2%
[libx264 # 0x27b2ca0] mb P I16..4: 0.5% 4.4% 0.9% P16..4: 31.1% 20.7% 12.1% 0.0% 0.0% skip:30.3%
[libx264 # 0x27b2ca0] mb B I16..4: 0.0% 0.3% 0.1% B16..8: 28.9% 5.5% 1.1% direct: 1.1% skip:63.1% L0:37.5% L1:52.6% BI: 9.9%
[libx264 # 0x27b2ca0] final ratefactor: 19.69
[libx264 # 0x27b2ca0] 8x8 transform intra:72.8% inter:68.3%
[libx264 # 0x27b2ca0] direct mvs spatial:99.9% temporal:0.1%
[libx264 # 0x27b2ca0] coded y,uvDC,uvAC intra: 74.5% 73.0% 30.4% inter: 13.0% 10.7% 0.2%
[libx264 # 0x27b2ca0] i16 v,h,dc,p: 49% 30% 3% 17%
[libx264 # 0x27b2ca0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 7% 14% 11% 7% 11% 8% 19% 8% 15%
[libx264 # 0x27b2ca0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 9% 13% 5% 8% 14% 10% 17% 9% 16%
[libx264 # 0x27b2ca0] i8c dc,h,v,p: 42% 29% 15% 15%
[libx264 # 0x27b2ca0] Weighted P-Frames: Y:7.4% UV:2.9%
[libx264 # 0x27b2ca0] ref P L0: 59.2% 20.2% 11.5% 3.7% 4.3% 1.0% 0.1%
[libx264 # 0x27b2ca0] ref B L0: 87.5% 8.8% 2.7% 1.0%
[libx264 # 0x27b2ca0] ref B L1: 96.5% 3.5%
[libx264 # 0x27b2ca0] kb/s:1030.01
On ffmpeg version N-93862-gf49cec2 (Ubuntu 18.04), the command fails immediately.
# ffmpeg -ss 60 -i ~/test.mp4 -y -filter_complex "[0:v]scale=-2:'min(320,ih)'[vs0];[vs0]crop=in_w/9:in_h/2:0:0,boxblur=5:1:cr=3:ar=3[b0];[vs0]crop=in_w/9:in_h/2:in_w-out_w:0,boxblur=5:1:cr=3:ar=3[b1];[vs0]crop=(in_w-2*in_w/9):in_h/20:in_w/9:0,boxblur=5:1:cr=3:ar=3[b2];[vs0][b0]overlay=0:0[ovr0];[ovr0][b1]overlay=main_w-overlay_w:0[ovr1];[ovr1][b2]overlay=main_w/9:0[vs1]" -map [vs1] -an -ac 2 -b:a 128k -acodec aac -b:v 1024k -r 30 -vcodec libx264 -t 300 -y -preset slow -movflags faststart -pix_fmt yuv420p -f mp4 ~/out.mp4
ffmpeg version N-93862-gf49cec2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-nonfree
libavutil 56. 27.100 / 56. 27.100
libavcodec 58. 52.101 / 58. 52.101
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 53.100 / 7. 53.100
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/root/test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.76.100
Duration: 00:10:00.00, start: 0.000000, bitrate: 1036 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 768x480, 1033 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
[mov,mp4,m4a,3gp,3g2,mj2 # 0x56055a5902c0] Invalid stream specifier: vs0.
Last message repeated 1 times
Stream specifier 'vs0' in filtergraph description [0:v]scale=-2:'min(320,ih)'[vs0];[vs0]crop=in_w/9:in_h/2:0:0,boxblur=5:1:cr=3:ar=3[b0];[vs0]crop=in_w/9:in_h/2:in_w-out_w:0,boxblur=5:1:cr=3:ar=3[b1];[vs0]crop=(in_w-2*in_w/9):in_h/20:in_w/9:0,boxblur=5:1:cr=3:ar=3[b2];[vs0][b0]overlay=0:0[ovr0];[ovr0][b1]overlay=main_w-overlay_w:0[ovr1];[ovr1][b2]overlay=main_w/9:0[vs1] matches no streams.
I want to create a slideshow with a background music by ffmpeg, and use the command
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -pix_fmt yuv420p -strict -2 video.mp4
and map.txt is like
file '1.jpg'
duration 15
file '2.jpg'
duration 60
The result is a video with the audio and blank background. If I run the above command without audio as
ffmpeg -f concat -safe 0 -i map.txt -pix_fmt yuv420p -strict -2 video.mp4
a perfect video of the images (the intended slideshow) is generated (but obviously without audio).
I reckon the problem is related to synchronising the audio and images.
This is the terminal output for the first command
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -pix_fmt yuv420p -strict -2 video.mp4
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0x1cc8d40] Changeing bps to 8
Input #0, concat, from 'map.txt':
Duration: 00:05:48.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, gray(bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, flac, from 'audio.flac':
Metadata:
TITLE : Speak to Me
ARTIST : Creator
ALBUM : Acoustic Hits
track : 14
GENRE : Pop
DATE : 2011
Duration: 00:03:31.02, start: 0.000000, bitrate: 1026 kb/s
Stream #1:0: Audio: flac, 44100 Hz, stereo, s16
[libx264 # 0x1ccdf80] using SAR=1/1
[libx264 # 0x1ccdf80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x1ccdf80] profile High, level 4.0
[libx264 # 0x1ccdf80] 264 - core 148 r2643 5c65704 - 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=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 'video.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp (16 bit), 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg # 0x7fe688001ba0] Changeing bps to 8
frame= 2 fps=0.7 q=-1.0 Lsize= 3593kB time=00:03:31.02 bitrate= 139.5kbits/s
video:147kB audio:3410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.036417%
[libx264 # 0x1ccdf80] frame I:1 Avg QP: 2.55 size: 33683
[libx264 # 0x1ccdf80] frame P:1 Avg QP:19.33 size:116022
[libx264 # 0x1ccdf80] mb I I16..4: 89.7% 1.1% 9.3%
[libx264 # 0x1ccdf80] mb P I16..4: 0.9% 1.8% 30.1% P16..4: 1.4% 1.5% 0.9% 0.0% 0.0% skip:63.4%
[libx264 # 0x1ccdf80] 8x8 transform intra:2.1% inter:15.2%
[libx264 # 0x1ccdf80] coded y,uvDC,uvAC intra: 19.7% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1ccdf80] i16 v,h,dc,p: 97% 2% 2% 0%
[libx264 # 0x1ccdf80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 39% 1% 1% 2% 1% 2% 4%
[libx264 # 0x1ccdf80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16% 3% 4% 6% 5% 5% 4%
[libx264 # 0x1ccdf80] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1ccdf80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1ccdf80] kb/s:20.65
UPDATE (following the comment suggestion)
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -r 5 -pix_fmt yuv420p -strict -2 video.mp4
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0x1fe9d80] Changeing bps to 8
Input #0, concat, from 'map.txt':
Duration: 00:02:28.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, gray(bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, flac, from 'audio.flac':
Metadata:
TITLE : Speak to Me
ARTIST : Creator
ALBUM : Acoustic Hits
track : 14
GENRE : Pop
DATE : 2011
Duration: 00:03:31.02, start: 0.000000, bitrate: 1026 kb/s
Stream #1:0: Audio: flac, 44100 Hz, stereo, s16
[libx264 # 0x1feefc0] using SAR=1/1
[libx264 # 0x1feefc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x1feefc0] profile High, level 4.0
[libx264 # 0x1feefc0] 264 - core 148 r2643 5c65704 - 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=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=5 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 'video.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 5 fps, 10240 tbn, 5 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp (16 bit), 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg # 0x7f74cc001ba0] Changeing bps to 8
frame= 2 fps=0.7 q=-1.0 Lsize= 3593kB time=00:03:31.02 bitrate= 139.5kbits/s
video:147kB audio:3410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.036417%
[libx264 # 0x1feefc0] frame I:1 Avg QP: 2.55 size: 33683
[libx264 # 0x1feefc0] frame P:1 Avg QP:19.33 size:116022
[libx264 # 0x1feefc0] mb I I16..4: 89.7% 1.1% 9.3%
[libx264 # 0x1feefc0] mb P I16..4: 0.9% 1.8% 30.1% P16..4: 1.4% 1.5% 0.9% 0.0% 0.0% skip:63.4%
[libx264 # 0x1feefc0] 8x8 transform intra:2.1% inter:15.2%
[libx264 # 0x1feefc0] coded y,uvDC,uvAC intra: 19.7% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1feefc0] i16 v,h,dc,p: 97% 2% 2% 0%
[libx264 # 0x1feefc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 39% 1% 1% 2% 1% 2% 4%
[libx264 # 0x1feefc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16% 3% 4% 6% 5% 5% 4%
[libx264 # 0x1feefc0] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1feefc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1feefc0] kb/s:20.65
I asked this on another forum but never had any luck. I found the following command online that is supposed to create a video from images(duration of 5 seconds each) using FFmpeg.
ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 out.mp4
I have ran that and I have two images named img001.png and img002.png, however when I play out.mp4, it's only a 5 second clip with img001.png being played. What's really strange as well, is in my Windows Media Player, it thinks it's 10 seconds long (2 images # 10 seconds), but when the gauge gets half way through(5 seconds) the video, it ends.
Any suggestions of what could be going on?
I also tried a bunch of other commands I found online but never had any luck. They would end up showing both images, but the first one would just flash for a fraction of a second, or some other ones would do the same thing would happen to the second image at the end of the video.
I have it ImageMagick installed into XAMPP on my Windows Vista PC. I can provide my command line output from the command if needed.
Edit: Added command line output
C:\xampp\htdocs>ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 out.mp4
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, image2, from 'img%03d.png':
Duration: 00:00:10.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24, 800x600 [SAR 1:1 DAR 4:3], 0.20 tbr, 0.20 tb
n, 0.20 tbc
[libx264 # 0032cae0] using SAR=1/1
[libx264 # 0032cae0] using cpu capabilities: MMX2 SSE2Slow SlowCTZ
[libx264 # 0032cae0] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 # 0032cae0] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Cop
yright 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 de
block=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 chr
oma_qp_offset=4 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=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=1 scenecu
t=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:
encoder : Lavf55.0.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv444p, 800x600 [SAR 1:1
DAR 4:3], q=-1--1, 16384 tbn, 0.20 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame= 2 fps=0.0 q=2621023.0 Lsize= 37kB time=00:00:10.00 bitrate= 30.0
kbits/s
video:36kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2.142993%
[libx264 # 0032cae0] frame I:1 Avg QP:11.18 size: 17627
[libx264 # 0032cae0] frame P:1 Avg QP:11.45 size: 18415
[libx264 # 0032cae0] mb I I16..4: 18.3% 69.5% 12.3%
[libx264 # 0032cae0] mb P I16..4: 11.6% 60.1% 9.7% P16..4: 8.9% 6.6% 2.2%
0.0% 0.0% skip: 0.8%
[libx264 # 0032cae0] 8x8 transform intra:71.4% inter:67.1%
[libx264 # 0032cae0] coded y,u,v intra: 57.0% 24.1% 22.3% inter: 42.6% 25.7% 16.
4%
[libx264 # 0032cae0] i16 v,h,dc,p: 28% 50% 15% 8%
[libx264 # 0032cae0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 39% 28% 2% 2% 2% 3%
3% 4%
[libx264 # 0032cae0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 53% 23% 1% 2% 2% 3%
0% 2%
[libx264 # 0032cae0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0032cae0] kb/s:28.83
C:\xampp\htdocs>
I think your only problem is that you're not telling ffmpeg what output format to use.
try ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 -pix_fmt yuv420p out.mp4
Also remember that the images have to be the same size. You'll need to preprocess them to the same size if they're not.
good luck