Creating ProRes Quicktimes on Windows with ffmpeg
Created by Bob Maple - 25-Oct-2012
While Apple has never released a ProRes encoding codec for Quicktime on Windows, some very
clever guys have reverse-engineered the codec and contributed it to the open-source project ffmpeg
. Here's a complete guide to getting going with ffmpeg so you can create ProRes Quicktimes on Windows without having to feed it into a Mac.
Note: There are other software tools that encode to ProRes on Windows, like Cinemartin Cinec
or SGO's MambaFX
which generally use the same underlying libav library that ffmpeg does for encoding.
To get setup:
- Pick up a copy of ffmpeg for Windows.
ffmpeg is a very active open-source project and the code changes often; There are no "official" Windows releases, but you can find several of the last few weeks' development builds up at Zeranoe - Grab one of the "Static" builds in 64-bit for running on your DS workstation.
- Unzip it into a folder on one of your drives; you might need 7zip if you don't have it, or modern versions of WinZip can probably decompress it too.
- Although there are many 3rd-party GUI front-ends for it, ffmpeg is natively a command-line application and as such we're going to go commando.
Open a Command Prompt or a PowerShell window by either hitting Windows Key-R and typing cmd, or by tapping the Windows key and typing Power to find PowerShell.
- CD into the ffmpeg\bin directory you unzipped:
Now let's encode something!
ffmpeg can read (and create) a myriad of codecs in a myriad of containers, but we'll use a Quicktime file as a source, aptly named SourceFile.mov, and create a new ProRes Quicktime called OutputProRes.mov. Our mythical file is an Uncompressed 10-bit 422yuv file, 1920x1080 at 23.98fps, with stereo audio (more on formats and exporting things specifically from DS later.)
Into your shell, type:
.\ffmpeg.exe -i SourceFile.mov -codec:v prores_ks -profile:v 2 -codec:a pcm_s16le -filter_complex asetnsamples=n=16384:p=0 OutputProRes.mov
Here's what everything does:
- -i SourceFile.mov
The source to compress. NOTE: If you have spaces in your filename or path, wrap the whole path in quotes, like "D:\Folder\Source File.mov"
- -codec:v prores_ks
Selects the video codec to be used as 'prores_ks' (there are actually two ProRes encoders in ffmpeg, 'prores' and 'prores_ks'; The 'prores' is faster than 'prores_ks' but creates files which wildly exceed the standard birates of the ProRes profiles, and doesn't properly support interlace.)
- -profile:v 2
Selects the prores_ks encoder profile to use:
- 0 = ProRes 422 Proxy
- 1 = ProRes 422 LT
- 2 = ProRes 422 Standard
- 3 = ProRes 422 HQ
- -codec:a pcm_s16le
Selects the audio codec to be used as uncompressed (PCM) 16-bit Signed Linear. For 24-bit audio use pcm_s24le NOTE: We assume the audio in your source is already 48khz, and it will get passed through ffmpeg and encoded as such. ffmpeg will also make its best choice/guess on the layout of the audio channels and encode them and mark them the same way (stereo, mono, etc.) There are many other options that can be passed to manipulate the audio which I have not included.
- -filter_complex asetnsamples=n=16384:p=0
The default mux rate ffmpeg uses is very small (only a couple of audio packets followed by one video packet) and can cause performance issues when playing back in realtime, including any apps that use Quicktime for realtime IO (like AMA on Media Composer.) The asetnsamples filter basically tells ffmpeg to use a longer string of audio packets in the mux, which in turn causes it to use a longer string of video packets to match. Without doing this you will likely have stuttering playback and dropped frames depending on the visual complexity of the frames (ProRes is variable bitrate.)
Lastly, the file to write out. ffmpeg automatically picks the output container format as Quicktime due to the .mov extension, so make sure you include it in the filename. NOTE: If you have spaces in your filename or path, wrap the whole path in quotes, like "D:\Folder\Output File.mov"
If your source Quicktime also had timecode, it should get passed along in the ProRes movie as well, or you can set it manually by adding -timecode HH:MM:SS:FF
to the parameters, somewhere before the output filename. Otherwise, that's basically it! As mentioned above, the prores_ks encoder is somewhat slow, although your mileage will vary based on many things like the speed of the disks you're reading from/writing to, what format the source file is, the complexity of the material, and of course the speed of your workstation.
Export suggestions from DS for feeding into ffmpeg
As mentioned, ffmpeg can read a variety of formats and codecs -- including image sequences -- and can even read from multiple sources. However, I'm only going to talk about Quicktimes here, and there are of course caveats because Quicktime is Quicktime.
For an ideal, perfectly color-matching ProRes encode from a 422 YUV sequence in DS version 10.5 or above
, the best way is to create an 8-bit Uncompressed 422 Quicktime from DS using the AJA 2vuy codec, which write out standard yuv422 Quicktimes -- they will import into Final Cut for instance and play realtime as standard 422 uncompressed files.
Why DS version 10.5 or above?
Because up until 10.5 DS's Quicktime IO was only RGB, which meant a YUV->RGB conversion by DS plus another RGB->YUV conversion by Quicktime, which screws up your levels and gamma. In v10.5 and above, DS can pass the YUV data directly to Quicktime as YUV and avoid all the screwups (and it's a ton faster.) When exporting the Quicktime, select 601/709
for your levels. Don't use Quicktime Reference Movies from DS because they decode as RGB, and have other broken behaviors.
They wouldn't work anyway since ffmpeg doesn't actually use Quicktime and thus can't access the DS reference codec.
For older versions of DS, well, you're going to have to either live with a colorspace conversion and your colors changing a bit, or bypass Quicktime by outputting a .YUV image sequence from DS with a separate audio file and feed them all into ffmpeg for encode. However that requires some different/extra command-line options to specify the image sequence and audio, set the frame rate, etc. which I'm not covering here. Perhaps I'll write a separate document if enough people need it. For Quicktime, your best bet is to create an Animation codec Quicktime at 100% quality, using Graphics
or Legacy Graphics
levels from DS. Just know that:
- If your sequence/media is 10-bit, you're squashing it down to 8-bit right out of the gate
- Your YUV is being converted to RGB and the levels are being scaled from 16-235 to 0-255 (and eventually back again) which can cause additional banding and artifacts
- The color conversion will be incorrect. In order to properly go from RGB to ProRes, you need to add the arguments:
-pix_fmt yuv422p10le -vf colormatrix=bt601:bt709
to the commandline, just before the output filename.
User Interface for FFmpeg
Appended by Igor Ridanovic - 12-Nov-2012
The command line gives you the full control of FFmpeg, but if you're not comfortable with it, or if you often encode ProRes with same parameters over and over again, you can try the batch file prores.bat.
and place on desktop or other place where you keep your batch files.
Prores.bat assumes that FFmpeg is installed on your system in a particular place. While the program path is correct for my system and the current build of FFmpeg, it will likely be wrong on other computers. To configure the path:
- Right click prores.bat
- Select "Edit"
- Look for line set FFmpegpath="C:\Program Files\ffmpeg-20121105-git-c995644-win64-static\bin"and change it to reflect the location of your FFmpeg (save the file too!)
Prores.bat can be used in drag-and-drop fashion or by double clicking the file.
Drag and drop a valid Quicktime file onto the prores.bat icon. This will launch FFmpeg and encode a "standard" quality 4:2:2 ProRes version of your clip and save it next to the original clip as originalname_ProRes.mov.
If you need to change the quality settings and/or the file name and destination path, double click prores.bat. The batch file will walk you through all the options. When entering paths and file names in prores.bat prompts, you don't have to enclose them in quotes whether or not they contain white spaces. In fact, using quotes will probably result in an error.
Revised: Jan 15, 2014 2:07 pm