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:
- Don’t use AVI container. Use MP4 instead.
- 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.
- Video file MUST be encoded at yuv420p colorspace (see this link for details).
- Use AAC codec for audio. With other codec file might not open in Vegas at all.
- Also, Vegas might ignore an audio track if its rate is 44100. Set it to 48000.
- 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.