2

I am trying to encode a raw yuv file to m4v as follows:

ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 30 -i akiyo_cif.yuv -vcodec mpeg4 a02.m4v

But it did not work and I got this error from the console output:

ffmpeg version 2.4.3-1ubuntu1~trusty6 Copyright (c) 2000-2014 the FFmpeg developers built on Nov 22 2014 17:07:19 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) configuration: --prefix=/usr --extra-version='1ubuntu1~trusty6' --build-suffix=-ffmpeg --toolchain=hardened --extra-cflags= --extra-cxxflags= --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-fontconfig --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-opengl --enable-x11grab --enable-libxvid --enable-libx265 --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libx264 --enable-libsoxr --enable-openal --enable-libopencv

libavutil 54. 7.100 / 54. 7.100 libavcodec 56. 1.100 / 56. 1.100 libavformat 56. 4.101 / 56. 4.101 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 1.100 / 5. 1.100 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100

Option b (video bitrate (please use -b:v)) cannot be applied to input file akiyo_cif.yuv -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.

Error parsing options for input file akiyo_cif.yuv

Error opening input files: Invalid argument

The akiyo_cif.yuv file can be foud here:

http://trace.eas.asu.edu/yuv/akiyo/akiyo_cif.7z

Can anyone help me with this please, I really need to make it work.

2

You have placed your bitrate option in the incorrect place as the error is telling you:

Option b (video bitrate (please use -b:v)) cannot be applied to input file 
akiyo_cif.yuv -- you are trying to apply an input option to an output file 
or vice versa. Move this option before the file it belongs to.

Remembering that the FFmpeg options always use this flow:

ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

The following adjusted syntax applies the corrected bitrate option to the output file rather than the input file:

ffmpeg -s cif -r 30 -i akiyo_cif.yuv -c:v mpeg4 -b:v 64k -bt 32k -g 30 a02.m4v

The quality of the output file is not all that great as you have specified a quite low bitrate, but this can of course be adjusted. Something like the following better quality video encode settings looks great on my system:

ffmpeg -s cif -r 30 -i akiyo_cif.yuv -c:v mpeg4 -q:v 5 a02.m4v

But perhaps you have a very specific need for your output video that this will not suit...

  • Thank you @andrew.46 your reply has really helped me. Now i can go forward with my project on evalvid. – jjfotso Aug 1 '16 at 11:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.