Copy mp3 with ffmpeg not playable by QuickTime - ffmpeg

I am trying to create a video out of one image and copy audio on top. Following this (last section), I tried:
$ ffmpeg -loop 1 -i img.jpg -i audio.mp3 -c:v libx264 -c:a copy -shortest h264.mp4
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Feb 23 2015 10:29:52 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --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 --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, image2, from 'img.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 123986 kb/s
Stream #0:0: Video: mjpeg, yuvj440p(pc, bt470bg/unknown/unknown), 1440x900 [SAR 72:72 DAR 8:5], 25 fps, 25 tbr, 25 tbn, 25 tbc
[mp3 # 0x7f94d2034600] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio.mp3':
Metadata:
genre : Other
Duration: 00:00:03.25, start: 0.000000, bitrate: 130 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, mono, s16p, 128 kb/s
[swscaler # 0x7f94d2800000] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 # 0x7f94d281b200] using SAR=1/1
[libx264 # 0x7f94d281b200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 # 0x7f94d281b200] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
[libx264 # 0x7f94d281b200] 264 - core 142 r2455 021c0dc - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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 'h264.mp4':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj444p(pc), 1440x900 [SAR 1:1 DAR 8:5], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc56.13.100 libx264
Stream #0:1: Audio: mp3 (i[0][0][0] / 0x0069), 44100 Hz, mono, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 64 fps= 30 q=28.0 size= 332kB time=00:00:00.48 bitrate=5670.9kbits/frame= 80 fps= 30 q=28.0 size= 344kB time=00:00:01.12 bitrate=2514.2kbits/frame= 96 fps= 30 q=28.0 size= 356kB time=00:00:01.76 bitrate=1655.1kbits/frame= 112 fps= 30 q=28.0 size= 367kB time=00:00:02.40 bitrate=1252.1kbits/frame= 129 fps= 31 q=28.0 size= 378kB time=00:00:03.08 bitrate=1006.5kbits/frame= 134 fps= 26 q=-1.0 Lsize= 386kB time=00:00:03.28 bitrate= 963.5kbits/s
video:331kB audio:51kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.120110%
[libx264 # 0x7f94d281b200] frame I:1 Avg QP:19.84 size:329471
[libx264 # 0x7f94d281b200] frame P:34 Avg QP:16.64 size: 189
[libx264 # 0x7f94d281b200] frame B:99 Avg QP:25.33 size: 48
[libx264 # 0x7f94d281b200] consecutive B-frames: 1.5% 0.0% 0.0% 98.5%
[libx264 # 0x7f94d281b200] mb I I16..4: 2.8% 70.0% 27.3%
[libx264 # 0x7f94d281b200] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 1.2% 0.0% 0.0% 0.0% 0.0% skip:98.8%
[libx264 # 0x7f94d281b200] 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: 1.6% L1:98.4% BI: 0.0%
[libx264 # 0x7f94d281b200] 8x8 transform intra:70.0% inter:95.0%
[libx264 # 0x7f94d281b200] coded y,u,v intra: 96.4% 73.8% 72.9% inter: 0.0% 0.0% 0.0%
[libx264 # 0x7f94d281b200] i16 v,h,dc,p: 37% 4% 1% 58%
[libx264 # 0x7f94d281b200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 27% 8% 3% 5% 5% 8% 4% 9%
[libx264 # 0x7f94d281b200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 18% 5% 3% 7% 7% 10% 5% 7%
[libx264 # 0x7f94d281b200] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7f94d281b200] ref P L0: 20.0% 0.4% 42.4% 37.2%
[libx264 # 0x7f94d281b200] ref B L0: 0.0% 100.0%
[libx264 # 0x7f94d281b200] ref B L1: 90.9% 9.1%
[libx264 # 0x7f94d281b200] kb/s:508.50
But I get a video with no audio in QuickTime. I think its a problem of the output container (mp4) not supporting mp3. What output container might be best? Due to quality loss, I am reluctant to convert the mp3 to another format. If my audio is mp3, what might I change about this ffmpeg command?
The final destination is YouTube.

Because YouTube is the final location you can ignore the other players:
Most non-FFmpeg based players can't decode yuvj444p. If you want the video in these other players to work, then add -pix_fmt yuv420p as an output option as mentioned in the console output.
Some players have trouble decoding MP3 in MP4 such as QuickTime and WMP with certain audio rates. If you need it to work in these players you'll need to re-encode to AAC audio by changing -c:a copy to -c:a aac.
Since the input is a single image you can reduce your frame rate for a much faster encoding by adding -framerate 1 as an input option. Again, some players may not be able to decode this frame rate.
YouTube can handle these potential issues, so feel free to upload it. See FFmpeg Wiki: YouTube for more info.

Related

ffmpeg convert cdg/mp3 to mp4 but cdg track is always sped up by a second

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.

FFmpeg Time Lapse from Sources with Long Frozen Tail End

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.

Video and audio stretch calculations in ffmpeg

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$

FFMPEG unwanted rotation

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

FFMPEG x264 MP4 Encoding all grey

I am currently using FFMPEG v1.1 on CentOS 6.3.
I configured FFMPEG with:
./configure --arch=x86_64 --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libx264 --enable-pthreads --enable-gpl --enable-runtime-cpudetect
when I run a simple command to record live input to MP4 by:
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 /home/irdb/Desktop/test.mp4
I get nothing, just a grey screen with some artifacts around the edges. However when I run the same command as .MPG it comes out fine. I need it in MP4 format however.
On a side note I am running x264-0.120 installed through yum
My question is, is there a problem with the way I compiled ffmpeg? Or is it possibly something else?
edit:
Output from example as requested:
# ffmpeg -f video4linux2 -s 640x480 -t 5 -i /dev/video0 -strict 2 /home/irdb/Desktop/test.mp4
ffmpeg version N-50546-g1f5b5b8 Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 7 2013 00:17:44 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-libmp3lame --enable-librtmp --enable-libtheora --enable- libvorbis --enable-libx264 --enable-pthreads --enable-gpl --enable-runtime-cpudetect
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
[video4linux2,v4l2 # 0x3025120] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 128.640356, bitrate: 147456 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[libx264 # 0x3026f80] using cpu capabilities: MMX2 SSE2Fast SSEMisalign LZCNT
[libx264 # 0x3026f80] profile High 4:2:2, level 3.0, 4:2:2 8-bit
[libx264 # 0x3026f80] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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 '/home/irdb/Desktop/test.mp4':
Metadata:
encoder : Lavf54.63.104
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv422p, 640x480, q=-1--1, 15360 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> libx264)
Press [q] to stop, [?] for help
frame= 32 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=21 drframe= 46 fps= 46 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=28 drframe= 62 fps= 41 q=29.0 size= 71kB time=00:00:00.33 bitrate=1735.2kbits/frame= 76 fps= 38 q=29.0 size= 169kB time=00:00:00.80 bitrate=1731.2kbits/frame= 93 fps= 37 q=29.0 size= 311kB time=00:00:01.36 bitrate=1862.3kbits/frame= 107 fps= 35 q=29.0 size= 423kB time=00:00:01.83 bitrate=1891.0kbits/frame= 123 fps= 35 q=29.0 size= 537kB time=00:00:02.36 bitrate=1860.2kbits/frame= 139 fps= 34 q=29.0 size= 664kB time=00:00:02.90 bitrate=1876.0kbits/frame= 150 fps= 29 q=-1.0 Lsize= 1174kB time=00:00:04.93 bitrate=1948.7kbits/s dup=81 drop=0
video:1172kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.133409%
[libx264 # 0x3026f80] frame I:2 Avg QP:23.22 size: 28460
[libx264 # 0x3026f80] frame P:136 Avg QP:24.45 size: 8397
[libx264 # 0x3026f80] frame B:12 Avg QP:26.18 size: 42
[libx264 # 0x3026f80] consecutive B-frames: 88.0% 4.0% 0.0% 8.0%
[libx264 # 0x3026f80] mb I I16..4: 47.1% 28.8% 24.1%
[libx264 # 0x3026f80] mb P I16..4: 4.3% 1.9% 1.2% P16..4: 29.0% 11.4% 9.2% 0.0% 0.0% skip:43.0%
[libx264 # 0x3026f80] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 1.5% 0.0% 0.0% direct: 0.0% skip:98.5% L0:16.5% L1:83.5% BI: 0.0%
[libx264 # 0x3026f80] 8x8 transform intra:26.4% inter:30.7%
[libx264 # 0x3026f80] coded y,uvDC,uvAC intra: 85.2% 95.6% 83.5% inter: 10.9% 38.6% 24.0%
[libx264 # 0x3026f80] i16 v,h,dc,p: 33% 19% 40% 8%
[libx264 # 0x3026f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 12% 55% 5% 3% 4% 4% 3% 8%
[libx264 # 0x3026f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 9% 63% 3% 2% 2% 2% 2% 2%
[libx264 # 0x3026f80] i8c dc,h,v,p: 66% 11% 14% 9%
[libx264 # 0x3026f80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x3026f80] ref P L0: 56.6% 7.5% 8.1% 27.8%
[libx264 # 0x3026f80] ref B L0: 83.3% 16.7%
[libx264 # 0x3026f80] ref B L1: 90.7% 9.3%
[libx264 # 0x3026f80] kb/s:1918.95
Your output video's pixel format is probably unsupported in the player you're using to show the video. If you observe your output logs, you can see yuv422p being chosen as the format. That's a 4:2:2 subsampled chroma in a planar format.
Choosing -pix_fmt yuv420p (4:2:0 subsampling) should give you an H.264-encoded video that can be viewed everywhere.
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 \
-c:v libx264 -pix_fmt yuv420p /home/irdb/Desktop/test.mp4
I explicitly set the video codec here. Just a good habit to develop so as not to be surprised when FFmpeg defaults to another encoder for a format. For example, choosing an MPEG output format made FFmpeg choose another default encoder, MPEG-1 (mpeg1video), which uses 4:2:0 subsampling again.

Resources