How to encode Vegas-compatible H.264 file using FFmpeg

Recently (as part of my work on integrating Remake into the workflow of some studio) I have faced a challenge of producing H.264 file, which is compatible with Sony Vegas.

Sony Vegas is pretty picky at H.264 (AVC) files and it refuses to accept files produced using ffmpeg with default settings. After a few days of investigation I’ve managed to find a set of rules for producing a valid Vegas-compatible files, so I decided to summarize them in this blog post. I hope my readers will forgive this little proprietary note in my blog.

So, here are the things to know:

  1. Don’t use AVI container. Use MP4 instead.
  2. Vegas will read H.264/MP4 files only if you have QuickTime installed. 32-bit QuickTime is fine to make 64-bit Vegas work as well.
  3. Video file MUST be encoded at yuv420p colorspace (see this link for details).
  4. Use AAC codec for audio. With other codec file might not open in Vegas at all.
  5. Also, Vegas might ignore an audio track if its rate is 44100. Set it to 48000.
  6. For obvious reasons it’s advised to use ffmpeg’s «-fastdecode» option.

To summarize it all, here’s the ffmpeg commandline to produce an mp4 file for Vegas:

ffmpeg -y -i file.avi -c:v libx264 -c:a aac -strict experimental -tune fastdecode -pix_fmt yuv420p -b:a 192k -ar 48000 output.mp4

And if you want something really close to a lossless encoding, then you can add «-crf 1» option:

ffmpeg -y -i file.avi -c:v libx264 -c:a aac -strict experimental -tune fastdecode -pix_fmt yuv420p -crf 1 -b:a 192k -ar 48000 output.mp4

All above tested on the clean Vegas 11/12 installation, without any modifications or library hacks (which you can find a lot on the web).

From my experience, Vegas 12 decoding was extremely faster than for Vegas 11. It was able to flawlessly read 1920×2160 files, while for vegas 11 I was forced to use low-res proxies to avoid the lags.


How to encode Vegas-compatible H.264 file using FFmpeg: 3 комментария

  1. Maciel

    I want to know if it’s possible make Sony Vegas uses ffmpeg.exe in rendering processes, without render first in lossless, and than convert it with ffmpeg.
    I’d like to insert ffmpeg encoder in the encoder list of render window. I’m looking for this answare for ages. I found only Frame Server to do this, but, doesn’t work in x64 Sony Vegas.

Добавить комментарий