I have a bunch of .avi videos encoded with Lagarith codec. We would like to convert them in to a lossless .MP4 format so that they could be easily played on html. I want to keep video specifications remain the same if it's possible and just convert the video to MP4.
I tried WinFF and also some manually written FFmpeg codes [without any specific reference to the Lagarith codec] but they all create a video which is not playable (neither with Windows Player nor with the HTML5 player). Also, FFmpeg returns exceptions like bellow.
Edit:
Here is the FFmpeg code generated by WinFF, this code gives me the following Exception:
"C:\Program Files\WinFF\ffmpeg.exe" -y -i "C:\Desktop\Videos\input.avi" -f mp4 -r 29.97 -vcodec libx264 -preset slow -vf scale=640:480 -b:v 1000k -aspect 4:3 -flags +loop -cmp chroma -b:v 1250k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libvo_aacenc -b:a 112k -ar 48000 -ac 2 "C:\Desktop\Videos\output.mp4"
2nd Edit:
Here is the entire exception that I receive:
C:\Users\Desktop\Videos>"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -y -i 300
4_KDSmall-08_02_2013-11_43_34_415.avi -crf 26 -vcodec libx264 -pix_fmt yuv420p -
acodec libvo_aacenc -ac 1 -ar 16000 -b:a 32000 3004_KDSmall-08_02_2013-11_43_34_
415.mp4
ffmpeg version N-62439-g5e379cd Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 13 2014 22:08:47 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable
-zlib
libavutil 52. 76.100 / 52. 76.100
libavcodec 55. 58.103 / 55. 58.103
libavformat 55. 37.100 / 55. 37.100
libavdevice 55. 13.100 / 55. 13.100
libavfilter 4. 4.100 / 4. 4.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, avi, from '3004_KDSmall-08_02_2013-11_43_34_415.avi':
Duration: 00:15:00.00, start: 0.000000, bitrate: 328 kb/s
Stream #0:0: Video: lagarith (LAGS / 0x5347414C), rgb24, 320x244, 326 kb/s,
7.50 tbr, 7.50 tbn, 7.50 tbc
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (3004_KD
Small-08_02_2013-11_43_34_415.mp4) has not been used for any stream. The most li
kely 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.
[libx264 # 0000000004288320] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX
[libx264 # 0000000004288320] profile High, level 1.2
[libx264 # 0000000004288320] 264 - core 142 r2409 d6b4e63 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 dec
imate=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=
7 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=26.0 qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '3004_KDSmall-08_02_2013-11_43_34_415.mp4':
Metadata:
encoder : Lavf55.37.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x24
4, q=-1--1, 15360 tbn, 7.50 tbc
Stream mapping:
Stream #0:0 -> #0:0 (lagarith -> libx264)
Press [q] to stop, [?] for help
frame= 1024 fps=0.0 q=27.0 size= 17kB time=00:02:08.80 bitrate= 1.1kbits/
frame= 1947 fps=1943 q=27.0 size= 234kB time=00:04:11.86 bitrate= 7.6kbits
frame= 2695 fps=1794 q=27.0 size= 659kB time=00:05:51.60 bitrate= 15.4kbits
frame= 3971 fps=1983 q=27.0 size= 680kB time=00:08:41.73 bitrate= 10.7kbits
frame= 5256 fps=2101 q=27.0 size= 702kB time=00:11:33.06 bitrate= 8.3kbits
frame= 6074 fps=2023 q=27.0 size= 1018kB time=00:13:22.13 bitrate= 10.4kbits
frame= 6343 fps=1810 q=27.0 size= 1625kB time=00:13:58.00 bitrate= 15.9kbits
frame= 6588 fps=1644 q=27.0 size= 2247kB time=00:14:30.66 bitrate= 21.1kbits
[lagarith # 0000000004378fc0] Unsupported Lagarith frame type: 0x24
[lagarith # 00000000043796c0] Unsupported Lagarith frame type: 0x38
[lagarith # 000000000437a700] Unsupported Lagarith frame type: 0x4c
[lagarith # 000000000437d740] Unsupported Lagarith frame type: 0x60
[lagarith # 000000000437e760] Unsupported Lagarith frame type: 0x74
[lagarith # 0000000007fcb800] Unsupported Lagarith frame type: 0x88
[lagarith # 0000000007fcc820] Unsupported Lagarith frame type: 0x9c
[lagarith # 0000000007fd0860] Unsupported Lagarith frame type: 0xb0
Error while decoding stream #0:0: Not yet implemented in FFmpeg, patches welcome
[lagarith # 0000000007fd0ce0] Unsupported Lagarith frame type: 0xc4
Error while decoding stream #0:0: Not yet implemented in FFmpeg, patches welcome
[lagarith # 0000000004378fc0] Unsupported Lagarith frame type: 0xd8
Error while decoding stream #0:0: Not yet implemented in FFmpeg, patches welcome
[lagarith # 00000000043796c0] Unsupported Lagarith frame type: 0xec
frame= 6750 fps=1524 q=-1.0 Lsize= 2881kB time=00:14:59.73 bitrate= 26.2kbit
s/s
video:2802kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 2.842291%
[libx264 # 0000000004288320] frame I:29 Avg QP: 8.05 size: 2113
[libx264 # 0000000004288320] frame P:1874 Avg QP:11.85 size: 799
[libx264 # 0000000004288320] frame B:4847 Avg QP:13.60 size: 270
[libx264 # 0000000004288320] consecutive B-frames: 1.3% 6.0% 8.6% 84.1%
[libx264 # 0000000004288320] mb I I16..4: 82.8% 4.8% 12.4%
[libx264 # 0000000004288320] mb P I16..4: 0.2% 0.2% 0.3% P16..4: 5.5% 4.9
% 5.0% 0.0% 0.0% skip:84.0%
[libx264 # 0000000004288320] mb B I16..4: 0.0% 0.0% 0.1% B16..8: 2.9% 2.2
% 1.4% direct: 0.7% skip:92.7% L0:55.4% L1:38.8% BI: 5.8%
[libx264 # 0000000004288320] 8x8 transform intra:13.7% inter:12.4%
[libx264 # 0000000004288320] coded y,uvDC,uvAC intra: 21.9% 42.5% 34.9% inter: 2
.7% 5.4% 4.8%
[libx264 # 0000000004288320] i16 v,h,dc,p: 81% 9% 8% 2%
[libx264 # 0000000004288320] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 14% 49% 2% 3%
4% 3% 2% 2%
[libx264 # 0000000004288320] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 14% 34% 4% 4%
5% 4% 4% 3%
[libx264 # 0000000004288320] i8c dc,h,v,p: 72% 12% 12% 4%
[libx264 # 0000000004288320] Weighted P-Frames: Y:0.1% UV:0.1%
[libx264 # 0000000004288320] ref P L0: 42.5% 5.1% 29.3% 23.0%
[libx264 # 0000000004288320] ref B L0: 52.8% 37.8% 9.5%
[libx264 # 0000000004288320] ref B L1: 82.3% 17.7%
[libx264 # 0000000004288320] kb/s:25.50
Any body could help me easily doing this conversion?
Related
I'm using FFMpeg locally on a Mac (actually using PHP-FFMpeg) and it's working perfectly. I'm running the same code on an Ubuntu server and whatever I try the output file is a tiny, low quality video with just 1 second length (the original is about 15 seconds).
I installed it on the server with
sudo apt update
sudo apt install ffmpeg
and then restarted the server. To test now I'm running
ffmpeg -i source.mp4 target.mp4
from the terminal and getting this output
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
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 'source.mp4':
Metadata:
major_brand : iso5
minor_version : 1
compatible_brands: isomiso5hlsf
creation_time : 2021-07-16T05:37:58.000000Z
Duration: 00:00:00.66, start: 0.000000, bitrate: 74037 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], 83522 kb/s, 30.20 fps, 600 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2021-07-16T05:37:58.000000Z
handler_name : Core Media Video
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 1774 kb/s (default)
Metadata:
creation_time : 2021-07-16T05:37:58.000000Z
handler_name : Core Media Audio
File 'target.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x55db778748c0] using SAR=1/1
[libx264 # 0x55db778748c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x55db778748c0] profile High, level 3.0
[libx264 # 0x55db778748c0] 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=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=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
frame= 8 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbOutput #0, mp4, to 'target.mp4':
Metadata:
major_brand : iso5
minor_version : 1
compatible_brands: isomiso5hlsf
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 30.20 fps, 28k tbn, 30.20 tbc (default)
Metadata:
creation_time : 2021-07-16T05:37:58.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(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)
Metadata:
creation_time : 2021-07-16T05:37:58.000000Z
handler_name : Core Media Audio
encoder : Lavc58.54.100 aac
frame= 15 fps= 14 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=3 droframe= 18 fps= 11 q=0.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/sframe= 18 fps=7.9 q=0.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/sframe= 18 fps=6.4 q=0.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/sframe= 19 fps=5.8 q=0.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/sframe= 19 fps=5.0 q=0.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/sframe= 20 fps=4.6 q=0.0 size= 0kB time=00:00:00.46 bitrate= 0.8kbits/s[aac # 0x55db778a2f00] Queue input is backward in time
[mp4 # 0x55db77876100] Non-monotonous DTS in output stream 0:1; previous: 23552, current: 20480; changing to 23553. This may result in incorrect timestamps in the output file.
[mp4 # 0x55db77876100] Non-monotonous DTS in output stream 0:1; previous: 23553, current: 21504; changing to 23554. This may result in incorrect timestamps in the output file.
[mp4 # 0x55db77876100] Non-monotonous DTS in output stream 0:1; previous: 23554, current: 22528; changing to 23555. This may result in incorrect timestamps in the output file.
[mp4 # 0x55db77876100] Non-monotonous DTS in output stream 0:1; previous: 23555, current: 23552; changing to 23556. This may result in incorrect timestamps in the output file.
frame= 20 fps=3.3 q=-1.0 Lsize= 77kB time=00:00:00.56 bitrate=1122.7kbits/s dup=3 drop=3 speed=0.0936x
video:69kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.688508%
[libx264 # 0x55db778748c0] frame I:1 Avg QP:22.13 size: 14863
[libx264 # 0x55db778748c0] frame P:5 Avg QP:25.37 size: 6279
[libx264 # 0x55db778748c0] frame B:14 Avg QP:26.80 size: 1720
[libx264 # 0x55db778748c0] consecutive B-frames: 5.0% 0.0% 15.0% 80.0%
[libx264 # 0x55db778748c0] mb I I16..4: 15.9% 65.9% 18.2%
[libx264 # 0x55db778748c0] mb P I16..4: 10.6% 11.7% 1.3% P16..4: 52.4% 11.2% 5.5% 0.0% 0.0% skip: 7.4%
[libx264 # 0x55db778748c0] mb B I16..4: 1.0% 1.3% 0.4% B16..8: 35.8% 3.0% 0.5% direct: 2.4% skip:55.6% L0:41.2% L1:55.5% BI: 3.3%
[libx264 # 0x55db778748c0] 8x8 transform intra:56.1% inter:82.3%
[libx264 # 0x55db778748c0] coded y,uvDC,uvAC intra: 54.1% 75.0% 21.1% inter: 14.6% 25.2% 0.1%
[libx264 # 0x55db778748c0] i16 v,h,dc,p: 9% 19% 3% 70%
[libx264 # 0x55db778748c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 18% 24% 5% 6% 9% 6% 6% 6%
[libx264 # 0x55db778748c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 20% 16% 6% 7% 7% 6% 5% 3%
[libx264 # 0x55db778748c0] i8c dc,h,v,p: 48% 25% 22% 5%
[libx264 # 0x55db778748c0] Weighted P-Frames: Y:40.0% UV:40.0%
[libx264 # 0x55db778748c0] ref P L0: 62.4% 17.4% 14.3% 5.7% 0.1%
[libx264 # 0x55db778748c0] ref B L0: 87.6% 10.7% 1.7%
[libx264 # 0x55db778748c0] ref B L1: 95.0% 5.0%
[libx264 # 0x55db778748c0] kb/s:849.86
[aac # 0x55db778a2f00] Qavg: 4594.708
Here's what the files look like
Any ideas what could be wrong?
Thanks for your help!
#llogan gave the perfect answer, see comments above. I ran this on the server to upgrade FFMpeg to the latest version and it's working correctly now
sudo add-apt-repository ppa:savoury1/ffmpeg4
sudo add-apt-repository ppa:savoury1/graphics
sudo add-apt-repository ppa:savoury1/multimedia
sudo apt full-upgrade
ffmpeg -version
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.
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.
I want to convert first few seconds (say 5 seconds) of a video to multiple output formats using ffmpeg.
when I Use this syntax to convert whole video, everything goes ok:
(to be simple, i left all options to be default)
ffmpeg -i input.flv output1.mp4 output2.avi
but when trying for just first 5 seconds using this syntax:
ffmpeg -t 5 -i input.flv output1.mp4 output2.avi
first output file (i.e ouptput1.mp4) is ok and it is 5 seconds length, but the second (and next outputs, if present) has a size of original file.
this is what ffmpeg prints out on the screen.
D:\ffmpeg\bin>ffmpeg -t 5 -i input.flv output1.mp4 output2.avi
ffmpeg version N-40301-gc1fe2db Copyright (c) 2000-2012 the FFmpeg developers
built on May 3 2012 11:40:38 with gcc 4.6.3
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
--enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib
libavutil 51. 49.100 / 51. 49.100
libavcodec 54. 17.101 / 54. 17.101
libavformat 54. 3.100 / 54. 3.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 72.104 / 2. 72.104
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 11.100 / 0. 11.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, flv, from 'input.flv':
Duration: 00:00:37.00, start: 0.000000, bitrate: 366 kb/s
Stream #0:0: Video: flv1, yuv420p, 320x240, 300 kb/s, 29.97 tbr, 1k tbn, 1k
tbc
Stream #0:1: Audio: mp3, 22050 Hz, mono, s16, 56 kb/s
[buffer # 01de98c0] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:fl
ags=2
[buffer # 01dea4e0] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:fl
ags=2
[libx264 # 02b067a0] using cpu capabilities: MMX2 Cache64
[libx264 # 02b067a0] profile High, level 1.3
[libx264 # 02b067a0] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_c
ompat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 we
ightb=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 'output1.mp4':
Metadata:
encoder : Lavf54.3.100
Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 320x240, q=-1--1, 3
0k tbn, 29.97 tbc
Stream #0:1: Audio: aac (#[0][0][0] / 0x0040), 22050 Hz, mono, s16, 128 kb/s
Output #1, avi, to 'output2.avi':
Metadata:
ISFT : Lavf54.3.100
Stream #1:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 320x240, q=2-31, 200
kb/s, 29.97 tbn, 29.97 tbc
Stream #1:1: Audio: mp3 (U[0][0][0] / 0x0055), 22050 Hz, mono, s16
Stream mapping:
Stream #0:0 -> #0:0 (flv -> libx264)
Stream #0:1 -> #0:1 (mp3 -> libvo_aacenc)
Stream #0:0 -> #1:0 (flv -> mpeg4)
Stream #0:1 -> #1:1 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
frame= 48 fps=0.0 q=29.0 q=2.4 size= 8kB time=00:00:00.16 bitrate= 399.6
frame= 62 fps= 59 q=29.0 q=2.4 size= 32kB time=00:00:00.63 bitrate= 408.8
frame= 73 fps= 46 q=29.0 q=3.5 size= 57kB time=00:00:01.00 bitrate= 466.1
frame= 104 fps= 50 q=29.0 q=3.5 size= 87kB time=00:00:02.03 bitrate= 349.7
frame= 134 fps= 52 q=29.0 q=3.6 size= 113kB time=00:00:03.03 bitrate= 303.9
***frame= 150 fps= 49 q=29.0 q=2.4 size= 126kB time=00:00:03.57 bitrate= 289.3
frame= 150 fps= 42 q=29.0 q=8.8 size= 126kB time=00:00:03.57 bitrate= 289.3
frame= 150 fps= 37 q=29.0 q=6.9 size= 126kB time=00:00:03.57 bitrate= 289.3
frame= 150 fps= 33 q=29.0 q=9.7 size= 126kB time=00:00:03.57 bitrate= 289.3
frame= 150 fps= 29 q=29.0 q=6.0 size= 126kB time=00:00:03.57 bitrate= 289.3
frame= 150 fps= 27 q=29.0 q=11.2 size= 126kB time=00:00:03.57 bitrate= 289.***
frame= 150 fps= 24 q=29.0 Lq=11.0 size= 171kB time=00:00:04.93 bitrate= 283
.7kbits/s
video:1282kB audio:225kB global headers:0kB muxing overhead -88.650217%
[libx264 # 02b067a0] frame I:1 Avg QP:10.27 size: 74
[libx264 # 02b067a0] frame P:114 Avg QP:23.49 size: 727
[libx264 # 02b067a0] frame B:35 Avg QP:29.30 size: 124
[libx264 # 02b067a0] consecutive B-frames: 68.0% 2.7% 0.0% 29.3%
[libx264 # 02b067a0] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 # 02b067a0] mb P I16..4: 2.1% 3.2% 0.1% P16..4: 19.2% 5.1% 3.6%
0.0% 0.0% skip:66.6%
[libx264 # 02b067a0] mb B I16..4: 0.2% 0.5% 0.0% B16..8: 9.6% 1.2% 0.4%
direct: 0.6% skip:87.4% L0:46.1% L1:42.5% BI:11.4%
[libx264 # 02b067a0] 8x8 transform intra:51.7% inter:78.4%
[libx264 # 02b067a0] coded y,uvDC,uvAC intra: 29.8% 44.5% 10.3% inter: 8.9% 10.3
% 2.2%
[libx264 # 02b067a0] i16 v,h,dc,p: 52% 31% 16% 1%
[libx264 # 02b067a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 25% 45% 1% 0% 1% 0%
1% 3%
[libx264 # 02b067a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 48% 23% 2% 1% 2% 3%
2% 1%
[libx264 # 02b067a0] i8c dc,h,v,p: 54% 26% 16% 3%
[libx264 # 02b067a0] Weighted P-Frames: Y:2.6% UV:0.9%
[libx264 # 02b067a0] ref P L0: 79.8% 7.0% 9.6% 3.6% 0.0%
[libx264 # 02b067a0] ref B L0: 92.5% 6.7% 0.8%
[libx264 # 02b067a0] ref B L1: 96.8% 3.2%
[libx264 # 02b067a0] kb/s:139.51
D:\ffmpeg\bin>
How is the correct syntax to get all output files same size?
isn't this a bug with ffmpeg? (note last lines of conversion progress, which all timestamps look same)
thanks in advance.
You need to add output options for each output:
ffmpeg -i input.flv -t 5 output1.mp4 -t 5 output2.avi
Consider adding an additional option for output quality--especially for the avi as libx264, if available, is the default for mp4 and the default options for libx264 are sane.
ffmpeg -i input.flv -t 5 output1.mp4 -t 5 -qscale 3 output2.avi
See FFmpeg: The ultimate Video and Audio Manipulation Tool for more information on -qscale (also called -q:v).
To save having to specify every file name you can use a FOR loop. This saves all flv and mp4 files as avi files with their original file names to a "NEW" folder. For use in a bat/cmd file:
md NEW
FOR /F "tokens=*" %%G IN ('dir /b *.flv') DO ffmpeg -y -i "%%G" -t 5 "NEW\%%~nG.avi"
FOR /F "tokens=*" %%G IN ('dir /b *.mp4') DO ffmpeg -y -i "%%G" -t 5 "NEW\%%~nG.avi"
I am trying to convert a flv video to mp4 using a264, but the result video has a out of sync audio/video. The audio seems ok but the video seems slow and therefore out of sync with the audio.
Here is the command I am running:
/opt/local/bin/ffmpeg -i complaint.flv -f mp4 -vcodec libx264 -acodec aac -copyts -strict experimental -fpre /opt/local/share/ffmpeg/libx264-lossless_slow.ffpreset -ab 44k -threads 0 -crf 23 complaint.mp4
And the output:
Desktop /opt/local/bin/ffmpeg -i complaint.flv -f mp4 -vcodec libx264 -acodec aac -copyts -strict experimental -fpre /opt/local/share/ffmpeg/libx264-lossless_slow.ffpreset -ab 44k -threads 0 -crf 23 complaint.mp4
ffmpeg version 0.7.8, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 12 2012 21:12:26 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
configuration: --prefix=/opt/local --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libopenjpeg --enable-libxvid --enable-libx264 --enable-libvpx --enable-libspeex --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
[flv # 0x7fe57a04ac00] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'complaint.flv':
Metadata:
duration : 7
creationdate : Thu Jan 12 23:47:24
description : Recorded using VideoRecording example.
Duration: 00:00:06.61, start: 0.000000, bitrate: N/A
Stream #0.0: Video: flv, yuv420p, 288x288, 1k tbr, 1k tbn, 1k tbc
Stream #0.1: Audio: nellymoser, 11025 Hz, mono, s16
File 'complaint.mp4' already exists. Overwrite ? [y/N] y
[buffer # 0x7fe579c32cc0] w:288 h:288 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
[libx264 # 0x7fe57a044600] using cpu capabilities: none!
[libx264 # 0x7fe57a044600] profile High, level 4.2
[libx264 # 0x7fe57a044600] 264 - core 118 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x33 me=umh subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=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.41 aq=1:1.00
Output #0, mp4, to 'complaint.mp4':
Metadata:
duration : 7
creationdate : Thu Jan 12 23:47:24
description : Recorded using VideoRecording example.
encoder : Lavf52.111.0
Stream #0.0: Video: libx264, yuv420p, 288x288, q=0-69, 200 kb/s, 1k tbn, 1k tbc
Stream #0.1: Audio: aac, 11025 Hz, mono, s16, 44 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop, [?] for help
frame= 6557 fps=106 q=-1.0 Lsize= 685kB time=00:00:03.62 bitrate=1549.1kbits/s dup=6367 drop=0
video:615kB audio:17kB global headers:0kB muxing overhead 8.361360%
frame I:27 Avg QP:19.98 size: 8242
[libx264 # 0x7fe57a044600] frame P:6530 Avg QP:30.71 size: 62
[libx264 # 0x7fe57a044600] mb I I16..4: 11.1% 79.3% 9.6%
[libx264 # 0x7fe57a044600] mb P I16..4: 0.1% 0.2% 0.0% P16..4: 1.2% 0.2% 0.3% 0.0% 0.0% skip:98.0%
[libx264 # 0x7fe57a044600] 8x8 transform intra:77.8% inter:64.9%
[libx264 # 0x7fe57a044600] coded y,uvDC,uvAC intra: 75.3% 81.3% 33.3% inter: 0.5% 0.7% 0.1%
[libx264 # 0x7fe57a044600] i16 v,h,dc,p: 78% 9% 10% 3%
[libx264 # 0x7fe57a044600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 11% 32% 3% 4% 5% 2% 5% 4%
[libx264 # 0x7fe57a044600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 56% 7% 9% 3% 4% 7% 3% 7% 3%
[libx264 # 0x7fe57a044600] i8c dc,h,v,p: 45% 15% 34% 6%
[libx264 # 0x7fe57a044600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x7fe57a044600] ref P L0: 80.5% 9.5% 10.0%
[libx264 # 0x7fe57a044600] kb/s:767.20
Is there something I'm missing to make sure the video and audio line up perfectly?
For those who may be trying this, I was better of recording flash in h264 right away, instead of using yuv420p for audio codec. That worked like a charm. Adding the flag -async 1 also helped.
Update: Check out this bit from the ffmpeg documentation (http://ffmpeg.org/ffmpeg.html):
-async: Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, the parameter is the maximum samples per second by which the audio is changed. -async 1 is a special case where only the start of the audio stream is corrected without any later correction. This option has been deprecated. Use the aresample audio filter instead.
You can read about the aresample filter here: http://ffmpeg.org/trac/ffmpeg/wiki/FilteringGuide