How to encode with ffmpeg
from Adobe Premiere Pro
Adobe Media Encoder can lack the quality, flexibility, and control that ffmpeg
can provide. There are two main methods to get your movie from Premiere to ffmpeg
:
- Output to a lossless intermediate file, or
- Use a frameserver
Creating a lossless intermediate file and using it as an input for ffmpeg
might seem simpler, but it has two obvious downsides: you have to wait for the file to be encoded, and the output file size can be very large. A frameserver will transfer the data to ffmpeg
without the need for a large temporary file, but it is a more complicated method. Both methods have their uses and this guide will show how to do both.
Note: These instructions were written using Adobe Premiere Pro CS6.
Output to a lossless intermediate file
- Save your project and close Premiere Pro
- Install Ut Video. It is a fast, lossless video encoder (and decoder), and is natively supported by
ffmpeg
.
- Open Premiere, select your sequence, and choose "File > Export > Media" (or hit Ctrl+M).
- Under "Export Settings" choose "Format: AVI" and make sure "Export Video" and "Export Audio" are both checked. Then under "Video Codec" choose "Ut Video Codec YUV420". Lastly, check your "Basic Video Settings" to make sure Premiere did not screw around with the frame size, frame rate, etc, as it is apt to do.
- Now you can encode with
ffmpeg
using your lossless file as an input. See the H.264 Encoding Guide for more information. You can then delete the temporary lossless file once you are satisfied with yourffmpeg
output.
Use a frameserver
- Install Debugmode FrameServer, Avisynth (32-bit), and ffmpeg (32-bit static build).
- Create an Avisynth script named
frameserver.avs
by opening a text editor and adding the following (assuming your working directory isc:\encode
):
AviSource("c:\encode\output.avi")
- Open Premiere, select your sequence, and choose "File > Export > Media" (or hit Ctrl+M).
- Under "Export Settings" choose "Format: DebugMode FrameServer" and make sure "Export Video" and "Export Audio" are both checked. Give your file the same name and path as shown in your Avisynth script (
output.avi
inc:\encode
for this example).
- The FrameServer setup window will appear. Choose "Next".
- Now you can encode with
ffmpeg
using your Avisynth script as an input. Example:
ffmpeg -i encode/frameserver.avs -c:v libx264 -preset medium -crf 23 -pix_fmt yuv420p -c:a libfdk_aac -vbr 4 output.mp4
See the H.264 Encoding Guide for more encoding details and examples.
FAQ
ffmpeg
gives me an error
[avs @ 0000000001ffde40] AVIFileOpen failed with error -2147221164 encode/frameserver.avs: Operation not permitted
This means you are probably trying to use 64-bit ffmpeg
with 32-bit Avisynth. For simplicity this guide demonstrates usage of 32-bit builds.
The "Export Settings" window in Premiere does not show up
Probably a bug in Premiere when using Debugmode FrameServer. Save your project (as a new project file) and restart Premiere.
The audio is out of sync after I encode with ffmpeg
from the frameserver
You can output the audio from Premiere and mux it with the ffmpeg encoded video from the frameserver. This example will ignore any audio from the first input (video.mp4
):
ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a libfdk_aac -vbr 5 -map 0:v:0 -map 1:a:0 -shortest output.mp4
Also See
Attachments (3)
-
frameserver-setup.png
(5.1 KB
) - added by 12 years ago.
Debugmode FrameServer
-
premiere-export-settings.png
(7.9 KB
) - added by 12 years ago.
Premiere Export Settings (frameserver)
-
premiere-export-settings-lossless.png
(12.0 KB
) - added by 12 years ago.
Premiere Export Settings (lossless)
Download all attachments as: .zip