I have a long ogg sounds file that I want to put on youtube, I don't have a video so want to display a single jpg for the duration for the ogg. I've seen:

 avconv -i "sound file.ogg" -i cog.jpg out.avi

I have adjusted the jpg to be 640 x 480 but I get the following warnings:

 Incompatible pixel format 'yuvj420p' for codec 'mpeg4', auto-selecting format 'yuv420p'

 Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
 [ac3 @ 0x18ae340] invalid bit rate

And it bombs out on:

 Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

Any ideas on what parameters I could use to make this work?

migrated from stackoverflow.com Mar 25 '13 at 10:23

This question came from our site for professional and enthusiast programmers.

up vote 6 down vote accepted

Without seeing the full command line output this boils down to guessing, but it seems avconv selects the AC3 encoder for audio here, which isn't a useful default.

Try specifying the encoders you want to use. For YouTube, H.264 and AAC is recommended instead of MPEG-4 Part 2 video and AC3 audio.

avconv -loop 1 -i cog.jpg -i "sound file.ogg" \
-c:v libx264 -tune stillimage -pix_fmt yuv420p \
-c:a libfaac -q:a 100 \
-shortest \

You should add the -loop 1 option to force looping the image, and the -shortest option to stop encoding after there's no more audio. Instead of -shortest you can also specify -t 00:02:30 to stop after 2:30 minutes, which would be more accurate than -shortest.

The above should work with any recent versions. Please note that avconv is not from FFmpeg, but the Libav fork and thus entirely unrelated to the ffmpeg command.

  • It bombs out on: Unknown encoder 'libfaac' replacing it with: libvo_aacenc seems to do the trick – pluke Apr 9 '13 at 11:08
  • 1
    This one offers quite mediocre quality. Use -c:a aac -strict experimental -b:a 192k for the native Libav one which is a little bit better, or install FAAC before installing Libav—it should then link against FAAC properly. – slhck Apr 9 '13 at 15:11

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.