I took a FLAC file and JPG to create a video

ffmpeg -loop 1 -i aa.jpg -i bb.flac -c:a copy -shortest cc.mkv

However after uploading the resultant MKV to YouTube I noticed that the audio cuts out about 5 times around the end for 1/2 second each.

I read on how to fix audio problems with YouTube, which suggest to use AAC.

Would it be best to use

  • FLAC with a different command
  • WAV
  • ALAC
  • AAC lossless (if that exists)
  • something else

To clarify, the errors only occur on YouTube, not with the local FLAC or local MKV files.

I ended up going with this silly command; the skipping seems to have gone away.

ffmpeg -loop 1 -i aa.jpg -i bb.flac -shortest \
  -c:a aac -strict -2 -b:a 529200 cc.mp4
  • libfdk-aac is ok, but libfaac struggles even at high bitrates. I would never recommend libfaac for anything. Even LAME MP3 will work better than libfaac. Safe AAC encoders: libfdk-aac Apple AAC Nero AAC Another option that would work is to upload a very high bitrate Vorbis audio track in a WEBM container.
    – LeonG
    Mar 5, 2013 at 18:39

2 Answers 2


While YouTube may interpret FLAC, it could very well be that their conversion process has a bug, or isn't resilient enough. If you cut the FLAC bitstream with -shortest, it could just happen that it's not properly written and YouTube chokes on that.

I've had YouTube produce playback errors for some formats I used for uploading, and it comes down to trial and error if you want to deviate from their encoding suggestions.

As for your alternatives:

  • WAV should see better support but is unnecessarily huge in terms of file size. You could give it a try regardless.
  • From what I've read, ALAC is not compatible with YouTube.

AAC should be your codec of choice. It doesn't offer a mathematically lossless mode, but listening tests suggest that at even 96 kBit/s (constrained) VBR encoding, quality is remarkably good.

Per the ISO/IEC 13818-7 standard which defines AAC, "it provides ITU-R 'indistinguishable' quality at a data rate of 320 kbit/s for five full-bandwidth channel audio signals." This means that even at 128 kBit/s CBR for stereo audio, you should have an acoustically lossless file given a good enough encoder (in FFmpeg, libfdk-aac and libfaac should be used, not libvo_aacenc and aac.)

YouTube's probably going to re-encode your video and audio anyway, so unfortunately there's no chance of uploading lossless and downloading the exact same bitstreams.

  • A higher bitrate ABX test between the four ffmpeg supported AAC-LC encoders would be interesting. aac may not be as bad as we expect at higher bitrates, but I haven't tried.
    – llogan
    Feb 24, 2013 at 18:56
  • Yeah… all I ever did was video quality testing, so I'll have to read up a little on the protocols for audio, but if I ever find the time I'll force a dozen students to do some ABC/HR testing for the AAC encoders to get a better feeling for what bit rates are acceptable :)
    – slhck
    Feb 24, 2013 at 19:50

AAC is perfectly fine. With high bitrates from 200 kbps upwards, it should be perceptually lossless. But never, ever use FAAC. It's basically the worst AAC encoder out there.


Browse through the various listening test results and see how FAAC places last in every AAC comparison. Nero and Quicktime are the best AAC encoders.

  • Since the OP is using FFmpeg, the choices for AAC encoders are quite limited. libfdk-aac and libfaac are the only reasonable encoders there.
    – slhck
    Apr 4, 2013 at 8:28
  • 1
    As someone mentioned, even Vorbis or LAME are better than FFMPEGs built-in AAC encoders, so use these codecs instead. They're both better than the built-in AAC encoders of FFMPEG.<br /> If you're desperate for AAC, I'd suggest batch converting FLAC to AAC first and then use FFMPEG to mux the existing AAC files into the video container. YouTube in fact doesn't care which audio codec you use for uploaded files as it re-encodes everything to AAC anyway. Apr 6, 2013 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .