YUV to mp4 conversion - macos

I am using the command:
ffmpeg -i MovieTest.yuv -vcodec libx264 -b 1200kb -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 1 -flags2 +fastpskip -dts_delta_threshold 1 -acodec libfaac -ab 128kb output.mp4
for yuv to mp4 conversion.
Here MovieTest.yuv is my input file and output.mp4 is my output file.
And I am using h.264 codec (libx264) for conversion.
It converts my most of the yuv files properly.
But sometimes, the conversion fails with the error on terminal:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '‪MovieTest.yuv‬':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
Duration: 00:00:06.45, start: 0.000000, bitrate: 109786 kb/s
Stream #0.0(und): Video: rawvideo, uyvy422, 640x480, 109675 kb/s, 22.31 fps, 27.25 tbr, 30k tbn, 30k tbc
Stream #0.1(und): Audio: aac, stereo, s16, 106 kb/s
[libx264 # 0x12180da00]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 # 0x12180da00]profile High, level 3.0
[libx264 # 0x12180da00]264 - core 98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html - options: cabac=1 ref=6 deblock=1:0:0 analyse=0x3:0x133 me=umh 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=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=0 weightp=0 keyint=12 keyint_min=7 scenecut=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=120 ratetol=33.3 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00
[libfaac # 0x12180e000]libfaac doesn't support this output format!
Output #0, mp4, to 'output.mp4':
Stream #0.0(und): Video: libx264, yuv420p, 640x480, q=10-51, 120 kb/s, 90k tbn, 27.25 tbc
Stream #0.1(und): Audio: libfaac, stereo, s16, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height
If anybody has any idea, that what is going wrong, plz help.

I think it's because your output bit rate (128kb) is higher than your input bit rate (106 kb).
I've just done a quick test and when I put my output higher than my input mine fails with the same errors as yours - it succeeds when I lower it again.
This may explain why it only fails for some inputs.
If you're scripting this in some way you'll have to use either 'ffmpeg -i' or something like MediaInfo to analyse your input source first and adjust accordingly.

Related

FFMPEG "Segmentation fault" with network stream source

I use release: 4.2.2 (static) from "https://johnvansickle.com/ffmpeg/"
Final code will be on "Amazon AWS lambda"
Goal: use a url stream and add watermak
Link to video: ​https://feoval.fr/519.mp4
Link to Watermak: ​https://feoval.fr/watermark.png
./ffmpeg -i "https://feoval.fr/519.mp4" -i "./watermark.png" -filter_complex "overlay=W-w-10:H-h-10:format=rgb" -f "mp4" -movflags "frag_keyframe+empty_moov" -pix_fmt "yuv420p" test.mp4
return "Segmentation fault"
I have the same error on my computer and on AWS Lambda server
./ffmpeg -i "https://feoval.fr/519.mp4" -f "mp4" -movflags "frag_keyframe+empty_moov" -pix_fmt "yuv420p" test.mp4
work (but not watermak)
./ffmpeg -i "./519.mp4" -i "./watermark.png" -filter_complex "overlay=W-w-10:H-h-10:format=rgb" -f "mp4" -movflags "frag_keyframe+empty_moov" -pix_fmt "yuv420p" test.mp4
work (but not with stream)
Thanks you very much !
Logs for the first case who return "Segmentation fault":
...
Stream mapping:
Stream #0:0 (h264) -> overlay:main (graph 0)
Stream #1:0 (png) -> overlay:overlay (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, ? for help
[libx264 # 0x742e480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x742e480] profile High, level 3.1, 4:2:0, 8-bit
[libx264 # 0x742e480] 264 - core 159 r2991 1771b55 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - ​http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=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 'test.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: isommp41mp42
encoder : Lavf58.29.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 480x848, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
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), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2020-01-13T08:54:26.000000Z
handler_name : Core Media Audio
encoder : Lavc58.54.100 aac
Segmentation fault (core dumped)
According to readme.txt that is packaged with the build from johnvansickle.com:
A limitation of statically linking glibc is the loss of DNS
resolution. Installing nscd through your package manager will fix
this.
Solution is to install and start the nscd service.
Alternative solutions:
Compile (see tutorials) your own ffmpeg (during ./configure enable gnutls, openssl, libtls or mbedtls for HTTPS support).
Use ffmpeg from your repository
Download the input file before using it in ffmpeg
Use IP address instead of domain name

How to make my video in landscape mode using ffmpeg

I have four video chats. Somehow I have managed to cut videos into pieces, stored in array then stacked and finally concat the video which is in the youtube link down below. I have used the size in the portrait view is 640*480. But I need to show them in the landscape. Suggest me any ideas.
Landscape view:
https://youtu.be/u8tmL2-CdK0
Portrait view:
https://youtu.be/lO-Q3I9X8OA
These are my inputs
Input #0, matroska,webm, from 'PA473fbf06ed1f952f95c88b9cf22ed0ba_pre.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2019-11-05T06:08:19.000000Z
Duration: 00:01:05.50, start: 63.041000, bitrate: 30 kb/s
Stream #0:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 tbr, 1k tbn, 2k tbc (default)
Metadata:
title : Video
Input #1, matroska,webm, from 'PA183db0ed986039de3197092103a411eb_pre.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2019-11-05T06:07:20.000000Z
Duration: 00:03:15.14, start: 4.062000, bitrate: 172 kb/s
Stream #1:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 fps, 15 tbr, 1k tbn, 2k tbc (default)
Metadata:
title : Video
Input #2, matroska,webm, from 'PA62a810038cbcc00be21fac43e98f5ee1_pre.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2019-11-05T06:07:45.000000Z
Duration: 00:02:21.71, start: 28.803000, bitrate: 92 kb/s
Stream #2:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 tbr, 1k tbn, 2k tbc (default)
Metadata:
title : Video
Input #3, matroska,webm, from 'PA8fa44ff1ba37ee510a045198bca6f04a_pre.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2019-11-05T06:07:48.000000Z
Duration: 00:01:50.69, start: 32.318000, bitrate: 28 kb/s
Stream #3:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 fps, 15 tbr, 1k tbn, 2k tbc (default)
Metadata:
title : Video
At first, I change all the video resolution to 640:480 because each video may have different resolution (probability). So I am setting a fixed resolution.
ffmpeg -i PA8fa44ff1ba37ee510a045198bca6f04a_pre.mkv -vf scale=640:480 PA8fa44ff1ba37ee510a045198bca6f04a.mkv -hide_banner
Input #0, matroska,webm, from PA8fa44ff1ba37ee510a045198bca6f04a_pre.mkv':
Metadata:
encoder : GStreamer matroskamux version 1.8.1.1
creation_time : 2019-11-05T06:07:48.000000Z
Duration: 00:01:50.69, start: 32.318000, bitrate: 28 kb/s
Stream #0:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 fps, 15 tbr, 1k tbn, 2k tbc (default)
Metadata:
title : Video
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler # 0000021d72eb3f80] deprecated pixel format used, make sure you did set range correctly
[libx264 # 0000021d72b33b40] using SAR=9/16
[libx264 # 0000021d72b33b40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0000021d72b33b40] profile High, level 2.2, 4:2:0, 8-bit
[libx264 # 0000021d72b33b40] 264 - core 158 r2984 3759fcb - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 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, matroska, to 'PA8fa44ff1ba37ee510a045198bca6f04a.mkv':
Metadata:
encoder : Lavf58.32.104
Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuvj420p(pc), 640x480 [SAR 9:16 DAR 3:4], q=-1--1, 15 fps, 1k tbn, 15 tbc (default)
Metadata:
title : Video
encoder : Lavc58.56.101 libx264
Two videos merging command
ffmpeg
-i ddb97d85-fc21-4fb4-8062-ca2084a48aeb.mkv
-i a8665a5f-fb5e-44cb-a072-070fbe07a14f.mkv
-filter_complex "[0:v][1:v]hstack" 1572934056.mkv
Three videos merging command
ffmpeg
-i 16f90447-c8b6-4077-b3b6-4fb2c07e19b5.mkv
-i ef501109-0ee9-4924-8de1-65eb796a4a78.mkv
-i 0b284aa6-4175-472c-aaf6-837412f97f32.mkv
-filter_complex "[1:v]scale=320:-1[left]; [2:v]scale=320:-1[right]; [left][right]hstack[bottom]; [0:v][bottom]vstack" 1572934058.mkv
Concat Command
ffmpeg
-i 1572934031.mkv -i 1572934056.mkv -i 1572934058.mkv -i 1572934089.mkv -i 1572934155.mkv -i 1572934169.mkv -i 1572934198.mkv -filter_complex "[0]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[0v];[1]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[1v];[2]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[2v];[3]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[3v];[4]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[4v];[5]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[5v];[6]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[6v];[0v][1v][2v][3v][4v][5v][6v]concat=n=7:v=1:a=0[v]" -map "[v]" 4c21f002fa76b148c00cc6fbceaa57ee.mp4
No need to pre-process. Do it all in one command. Assuming desired output size is 1280x960:
ffmpeg \
-i left-1.mkv -i right-1.mkv \
-i topleft-2.mkv -i topright-2.mkv -i bottom-2.mkv \
-filter_complex \
"[0]scale=640:480:force_original_aspect_ratio=decrease,pad=640:960:(ow-iw)/2:(oh-ih)/2,setsar=1[left1];
[1]scale=640:480:force_original_aspect_ratio=decrease,pad=640:960:(ow-iw)/2:(oh-ih)/2,setsar=1[right1];
[left1][right1]hstack=inputs=2[set1];
[2]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[topleft2];
[3]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1[topright2];
[4]scale=640:480:force_original_aspect_ratio=decrease,pad=1280:480:(ow-iw)/2:(oh-ih)/2,setsar=1[bottom2];
[topleft2][topright2][bottom2]xstack=inputs=3:layout=0_0|w0_0|0_h0[set2];
[set1][set2]concat=n=2:v=1:a=0[v]" \
-map "[v]" output.mp4

FFmpeg - Merge two images (.png) to video (.mp4) doesn't work

I want to merge two images (names are not numbered in a sequence) to a video, but the result includes only a video of the first image.
I would appreciate any kind of help!
ffmpeg.exe -r 1/5 -i image_x.png -r 1/5 -i image_y.png -codec:v libx264 -vf fps=50 video.mp4
Output:
Input #0, png_pipe, from
'C:\Users\khj\Desktop\SpeakerLayoutTool\Images_video\iamge_x.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 3840x2160, 25 tbr, 25 tbn, 25 tbc Input #1, png_pipe, from
'C:\Users\khj\Desktop\SpeakerLayoutTool\Images_video\image_y.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 3840x2160, 25 tbr, 25 tbn, 25 tbc File 'C:\Users\khj\Desktop\SpeakerLayoutTool\video.mp4' already
exists. Overwrite ? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (png
(native) -> h264 (libx264)) Press [q] to stop, [?] for help [libx264 #
0000016c2a46e000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 BMI2 AVX2 [libx264 # 0000016c2a46e000] profile High 4:4:4
Predictive, level 5.2, 4:4:4, 8-bit [libx264 # 0000016c2a46e000] 264 -
core 157 r2970 5493be8 - 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=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
'C:\Users\khj\Desktop\SpeakerLayoutTool\video.mp4': Metadata:
encoder : Lavf58.27.103
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 3840x2160, q=-1--1, 50 fps, 12800 tbn, 50 tbc
Metadata:
encoder : Lavc58.52.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 frame= 250 fps= 22 q=-1.0 Lsize= 162kB time=00:00:04.94 bitrate=
268.1kbits/s speed=0.444x
Use
ffmpeg.exe -loop 1 -t 5 -i image_x.png -loop 1 -t 5 -i image_y.png -filter_complex "concat=n=2:v=1:a=0" -pix_fmt yuv420p -c:v libx264 video.mp4

Unable to record video without audio in windows using ffmpeg

I am using ffmpeg to record the desktop on windows.Everything works fine if i play the audio in PC,when i try to record without playing any audio i am not able to get the desired output file.
Used the following command to start the recording
"-f gdigrab -framerate 10 -i desktop -f dshow -i audio="virtual-audio-capturer" -ac 2 -ar 44100 -acodec aac -ab 192k -pix_fmt yuv420p -r 30 -vcodec h264 -crf 27 -preset ultrafast -f mp4 Recording_2017-18-1--18-42-12.mp4"
Got the following output in cmd line
[gdigrab # 037abaa0] Capturing whole desktop as 1600x900x32 at (0,0)
[gdigrab # 037abaa0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, gdigrab, from 'desktop':
Duration: N/A, start: 1484893527.269157, bitrate: 460804 kb/s
Stream #0:0: Video: bmp, bgra, 1600x900, 460804 kb/s, 10 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, dshow, from 'audio=virtual-audio-capturer:':
Duration: N/A, bitrate: N/A
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[libx264 # 052e50a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 052e50a0] profile Constrained Baseline, level 4.0
[libx264 # 052e50a0] 264 - core 148 r2744 b97ae06 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=27.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'fileName.mp4':
Metadata:
encoder : Lavf57.61.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1600x900, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.70.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), 44100 Hz, stereo, fltp, 192 kb/s
Metadata:
encoder : Lavc57.70.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[aac # 052e7360] Qavg: nan
Exiting normally, received signal 2.
The output file is 1 kb.

ffmpeg Too many bits per frame requested

I am using ffmpeg to convert videos to mp4 format. Everything works fine except with MOV format.
The command I use for everything is:
ffmpeg -i input.mov -strict experimental -sameq -s vga -aspect 1.7777 -vcodec libx264 -preset fast -crf 22 -y output.mp4
but the output I keep getting is:
ffmpeg version 0.9, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 12 2012 11:01:05 with gcc 4.4.5
configuration: --enable-libx264 --enable-gpl --disable-yasm
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 42. 0 / 53. 42. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[mov,mp4,m4a,3gp,3g2,mj2 # 0x21767a0] Referenced QT chapter track not found
Seems stream 0 codec frame rate differs from container frame rate: 30.00 (30/1) -> 30.07 (2225/74)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
Metadata:
creation_time : 2009-04-04 07:12:29
comment : EASTMAN KODAK COMPANY KODAK Z1275 ZOOM DIGITAL CAMERA
comment-eng : EASTMAN KODAK COMPANY KODAK Z1275 ZOOM DIGITAL CAMERA
Duration: 00:00:17.76, start: 0.000000, bitrate: 8100 kb/s
Stream #0:0(eng): Video: mpeg4 (Advanced Simple Profile) (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 7968 kb/s, 30.07 fps, 30.07 tbr, 8544k tbn, 30 tbc
Metadata:
creation_time : 2009-04-04 07:12:29
handler_name :
Stream #0:1(eng): Audio: pcm_mulaw (ulaw / 0x77616C75), 16000 Hz, 1 channels, s16, 128 kb/s
Metadata:
creation_time : 2009-04-04 07:12:29
handler_name :
[buffer # 0x2187f00] w:1280 h:720 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
[scale # 0x219c120] w:1280 h:720 fmt:yuv420p -> w:640 h:480 fmt:yuv420p flags:0x4
[libx264 # 0x2190d20] using SAR=4/3
[libx264 # 0x2190d20] using cpu capabilities: none!
[libx264 # 0x2190d20] profile High, level 3.0
[libx264 # 0x2190d20] 264 - core 120 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 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 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[aac # 0x21917e0] Too many bits per frame requested
Output #0, mp4, to 'output.mp4':
Metadata:
creation_time : 2009-04-04 07:12:29
comment : EASTMAN KODAK COMPANY KODAK Z1275 ZOOM DIGITAL CAMERA
comment-eng : EASTMAN KODAK COMPANY KODAK Z1275 ZOOM DIGITAL CAMERA
Stream #0:0(eng): Video: h264, yuv420p, 640x480 [SAR 4:3 DAR 16:9], q=-1--1, 90k tbn, 30.07 tbc
Metadata:
creation_time : 2009-04-04 07:12:29
handler_name :
Stream #0:1(eng): Audio: aac, 16000 Hz, 1 channels, s16, 128 kb/s
Metadata:
creation_time : 2009-04-04 07:12:29
handler_name :
Stream mapping:
Stream #0:0 -> #0:0 (mpeg4 -> libx264)
Stream #0:1 -> #0:1 (pcm_mulaw -> aac)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
It seems the problem is with audio's bit per frame.
Which might be the right solution?
The "Too many bits per frame requested" error is coming from the native FFmpeg AAC encoder (-c:a aac). You can use one or more of the following solutions:
Update your ffmpeg
Development is very active and the native FFmpeg AAC encoder has seen many improvements; it will now automatically clamp to the max number of bits per frame instead of failing with this error. See the FFmpeg Download page for links to already compiled binaries which are the easiest method to get a recent ffmpeg.
If you're stuck with an old, outdated, ancient ffmpeg:
Increase the audio sampling rate such as by adding -ar 44100.
Decrease your bitrate. Default is probably -b:a 128k. Try lower values until it works.
Use -c:a copy to stream copy (re-mux) the audio, and, because MP4 doesn't support pcm_mulaw, use different output container format such as Matroska (.mkv).
Use a different AAC encoder such as libfdk_aac if your ffmpeg supports it.
You don't need to do any of these options if you upgrade ffmpeg.
I'd hope ffmpeg is more clever than this, but you might try specifying the video stream for your -s and -aspect options: -s:v and -aspect:v.
Alternately, since you're not doing anything special with the audio, you could copy it explicitly with -c:a copy.

Resources