Page 1 of 1

MediaCoder for Adobe Premiere CS3

Posted: Sun Aug 22, 2010 12:52 pm
by meRobs
[updated 20 Nov 2010]

Adobe Premiere is an NLE (non-linear editing) program that is usually used in conjunction with Adobe Encore, for authoring.
For a discussion on authoring, see: viewtopic.php?f=17&t=8454&start=0.
NLE programs are able to access and edit each and every frame in a video/audio file with the same ease, and to do so the imported file needs to be in a suitable format.
This is where MediaCoder comes in! It will be needed to convert your source files into a format that Premiere can handle.

For this study, I used Adobe Premiere CS3 and MediaCoder builds 4640 (mostly) and 4720 (for checking).
Whereas, Premiere can export movies to suit the web, iPods and SVCDs, etc, I will limit this discussion to those files needed for authoring to DVDs and Blu-ray discs.

Contents
1. File Formats compatible with Premiere CS3
2. Interlaced or Progressive?
3. The GOP Length
4. Benchmarks for Video Bitrate
5. Codec/Container combinations considered
6. Format choices that work for DVDs
7. Format choices that work for Blu-ray discs
8. Conclusion

1. Files Formats compatible with Premiere CS3
Of all the formats that Premiere CS3 is able to import, those most suitable for this study are AVI (DV, etc), MPEG and WMV files (containers), all of which may be created in MediaCoder.
To this end, I examined:

Video Codecs: Huffyuv, DV Video, MPEG2, MPEG4, and WMV8.
Since Xvid is merely a form of MPEG4, I checked its use only briefly, just enough to indicate that the conclusions I formed with MPEG4 probably apply to it. Also, WMV7 and WMV9 were not tried since they are not available in most builds of MediaCoder (up to 4788, at least).
All these video Codecs, except DV Video, will deliver a variety of frame sizes up to and including 1440x1080 (at least) and frame rates to suit PAL and NTSC. On the other hand, the DV Video Codec delivers only at the frame size of 720x576 pixels (PAL). Despite this limit, it is included in this study because, apart from Huffyuv, it is the only Codec that creates video with all frames as Keyframes, each being complete and not relying on the others. It thereby works well in Premiere.

Audio Codecs: PCM (i.e., WAV, fixed at 1411 kbps), ADPCM (352.8 kbps), MP2 and AC3.
The four Codecs were tried at both sampling frequencies: 44.1 kHz and 48 kHz.
The different versions of WMA (7, 8 and 9.2) could not be tried since most MediaCoder builds failed to support them even in the WMV (ASF) container. Whereas, Premiere will accept an audio-only file in MP3, it will not support MP3 with any video format considered here except Huffyuv.

The MPEG2 container would not accept PCM or ADPCM audio and the WMV container would not accept the AC3 or MP2. The AVI container would accept all audio options, although, Premiere would accept AC3 with MPEG4 or DV Video only if sampled at 48 kHz! By contrast, when a container accepted ADPCM, Premiere would import the file only if the ADPCM was at 44.1 kHz!

Note 1: to enable Premiere to accept and play AC3, I copied the ad2ac3dec.dll file from the Adobe Encore folder (under Program Files > Adobe) to the root folder for Premiere.

2. Interlaced or Progressive?
The meaning of 'Interlaced' and 'Progressive' and their differences, is discussed in the Guide: viewtopic.php?f=17&t=9867&start=0.

Regardless of whether Premiere is to export its edited movie as progressive or interlaced, editing in Premiere may well be slightly easier and the results better if the imported clips are progressive. This makes sense since each frame on the Timeline is then a full frame. This requirement suits MediaCoder because, by default, de-interlacing is set on Auto, which should de-interlace any interlaced source file and create a progressive output. When exporting from Premiere to MPEG2 or MPEG2-DVD, for example, the default is for BFF interlaced, although, this may be changed to TFF or to Progressive. For the latter, also set De-interlacing!

Warning: Do not enable de-interlacing in MediaCoder for all source files, assuming it would be a mere over-kill for files already progressive!
De-interlacing a progressive file causes blurring and loss of definition – readily seen in Premiere.

I have compared all nine de-interlacing algorithms available in MediaCoder using a quality VOB file in NTSC. They were examined on the Timeline of Premiere, in slow motion, and when exported as progressive and examined in VirtualDubMod (frame by frame) or on a large progressive TV. It was obvious that the clearest outcomes were via the 4 algorithms: Linear Interpolation, Cubic Interpolation, YADIF and Motion Compensation, the last taking 5-6 times longer to convert than the others. Under even closer examination, I judged Cubic Interpolation to be slightly better for the file tested. This finding would depend on the source file, is subjective and, in any case, the differences between these four were only slight (hard to spot).

Image

The above Figure shows the effect of three de-interlacing choices in MediaCoder for an interlaced frame, as seen after exporting from Premiere as a Progressive file.
The 'Disabled' image shows the effect of combining two interlaced video Fields (taken at different times), showing the resultant 'combing' effect along moving edgs, the 'Linear Blend' image is blurred because it merely blends (averages) the two fields together, and 'Cubic Interpolation', which is relatively clear. At this magnification the differences between Cubic Interpolation, shown at right, Linear Interpolation, YADIF and Motion Compensation would not be detectable.

3. The GOP length
When creating AVI files with the DV Video or Huffyuv Codecs all frames are complete, all are effectively I-frames (Intra -frames) or Keyframes. As a result they play and scrub in Premiere with ease. I-frames are independent of other frames, and DV frames are individually compressed via image compression techniques.

On the other hand, the other video Codecs rely on Interframe compression in which the frames between the I-frames contain data that defines only how their original frames differ from the content of I-frames. There are two types: P-frames and B-frames, the latter being the more compressed.

The video Codecs have default settings for the number of frames between Keyframes and MediaCoder allows this spacing to be changed easily for the FFmpeg Codec. This should be done by clicking the Encoder button on the Video tab and changing “Maximum interval between Keyframes” from the default of 250 frames to 12, say. This results in 8% of the frames being I-frames and the remainder, as P-frames, and leads to easier scrubbing and more accurate editing in Premiere.

For DVDs, the Keyframe spacing is usually referred to as the GOP (Group of Pictures) length and must be less than 15 for PAL (usually 12) and less than 18 for NTSC (usually 15) -- see also viewtopic.php?f=17&t=8282&start=0.

4. Benchmarks for Video Bitrate
For NTSC, there are 720x480 pixels in each frame and 29.97 frames in each second, hence, there are 10,357,632 pixels/sec for an encoder to handle. On the other hand, PAL files have 720x576x25 = 10,368,000 pixels/sec, a similar number. Hence, the required video bitrate for any given quality would be much the same for both PAL and NTSC.

From my experience with DVD-compliant MPEG2 in NTSC for standard DVDs, video quality is not noticeably reduced until it falls below ~2500 kbps (2.5 Mbps).
This was determined by ripping segments from quality commercial DVDs, editing in Premiere, exporting at various bitrates and, via Adobe Encore, authoring them to DVD with the original as-ripped VOB segments for comparison. They were then judged on a 50 inch Pioneer TV.
And, certainly, at 3.0 Mbps I was not able to detect any quality loss.
Of course, this is very subjective!

So, for a DVD, let's take 3.0 Mbps as a convenient benchmark level. And as it applies to video in the final DVD, we need to go back one step, to the editing phase in Premiere. To minimize any slight downgrading that Premiere may introduce, we should aim to feed Premiere with source files from MediaCoder at video bitrates in excess of 3 Mbps, if possible. For DVDs, I would previously output from MediaCoder at 4-5 Mbps, for MPEG2 or MPEG4, since these rates are easily obtained. However, since this study, I shall use the advice given below (use max rate)!
It is likely that the MPEG4 Codec is more efficient than the MPEG2, in which case, the 3.0 Mbps benchmark would be an even safer option. If we convert in MediaCoder using the DV Video Codec (PAL only) or the Huffyuv, the question is irrelevant since they generate much higher and fixed bitrates.

For Blu-ray discs in 720p25 or 720p30, using frames with 1280x720 pixels, there would be an average of 25,344,000 pixels/sec, 2.45 times as many as on a DVD. For frames of 1440x1080 pixels, there would be 4.13 times as many pixels/sec. Thus, the benchmark for a Blu-ray disc would be 7.35 Mbps and 12.4 Mbps, respectively, when the quality is equated to that for 3.0 Mbps in a DVD.

5. Codec/Container combinations considered
As seen in section 1, not all audio and video Codec combinations will work. Some will not sit together in any given Container and, of those that can be combined, some will not be accepted into Premiere. Even when accepted, they may not play in Premiere!
Fortunately, though, there are enough choices left to satisfy our needs.

The findings given below were obtained using MediaCoder Presets applied to MPG source files in both PAL and NTSC extracted from DVDs.
They include the following features needed by Premiere:
* A GOP length of 12, as set under section 3, above, and
* De-interlacing enabled (not 'Auto' - see section 2) as Cubic Interpolation, since the source files for MediaCoder were Interlaced MPGs.

DV Video in an AVI container: This combo will play in Premiere for audio streams in PCM or MP2 and at both sample frequencies. Remember, though, that DV Video will deliver frames at only 720x576 (PAL DVDs only).
Huffyuv in an AVI container: For this combo, audio streams in any of the 4 formats will play in Premiere, at either sample frequency (see section 1). The Huffyuv Codec will generate all suitable frame sizes and rates. However, for some reason I cannot fathom, files in 1440x1080 pixels will not play in Premiere.
MPEG2 in an MPEG2 container: This combo will play in Premiere if the audio is AC3 or MP2 at either sampling frequency, and the container would not accept PCM or ADPCM. The MPEG2 Codec will generate all suitable frame sizes and rates.
MPEG4 in an AVI container: of the four audio formats tried, MP2 and PCM are the only ones that are both accepted in the combo and play in Premiere, at both sampling frequencies. ADPCM will import but there was no sound for 48 kHz and AC3 imported but played only at 48 kHz! The MPEG4 Codec will generate all suitable frame sizes and rates.
WMV8 in an WMV (ASF) container: The only audio formats, of those tried, that are accepted in this container and play in Premiere, at the sampling frequencies of 44.1 or 48 kHz, are the ADPCM and PCM. The WMV8 video Codec will generate all suitable frame sizes and rates.
There are other Codec/Container possibilities, but, they are similar to the above and offer no advantages that I could find.

6. Format Choices that Work for DVDs
Files converted in the above five combinations were examined in Premiere CS3. The DV Video, Huffyuv and WMV8 video streams were with PCM audio (fixed at 1411 kbps) and the others, with MP2 at 128 kbps. In all cases, the GOP length and de-interlacing algorithm were as stated in section 5.

On MediaCoder's video tab, I chose the ABR (Average Bit Rate) mode with the slider at its maximum (20,000 kbps in build 4640 or 16,000 kbps in build 4788). This is irrelevant for the DV Video and Huffyuv Codecs since their bitrates are not adjustable. However, for all Codecs, the resultant bitrate in the output file will depend on the level of detail and degree of motion in the source file and on the de-interlacing algorithm, if used. The effect of these factors is much the same for all Codecs, but are proportionally greater for the MPEG2, MPEG4 and WMV8 Codecs, because of their smaller sizes.

For this reason, all the relative file sizes (MB/min) given below were obtained with the same source file and converted at max ABR. Apart from the DV Video, the conversions in MediaCoder were for frames of 720x480 pixels. The file size and video bitrate, under the above conditions, were (in build 4640):
* DV Video/AVI ...... 216 MB/min (video at 24.4 Mbps)
* Huffyuv/AVI ....... 607 MB/min (video at ~84 Mbps)
* MPEG2/MPEG2 ..... 50.7 MB/min (video at 6.82 Mbps).
* MPEG4/AVI ..........41.3 MB/min (video at 5.63 Mbps).
* WMV8/WMV ........ 56.0 MB/min (video at 6.10 Mbps).
* value for Huffyuv (MediaInfo) is not consistent with the file size. In any case, it's large!

In Premiere, all but the MPEG2 had render bars, which seems unimportant since the Huffyuv and MPEG4 scrubbed and played just as readily and smoothly as the MPEG2. The WMV file played but scrubbed sluggishly. The Huffyuv and MPEG4 were indistinguishable with rich natural skin colouring and the MPEG2 looked a little pinker, yet, possibly closer to that of the original source file. The WMV had a little less colour saturation and some faint blotchiness in colour.

Overall, the Huffyuv, MPEG2 and MPEG4 clips were equally sharp and their slight colour differences would be up to personal preference and, if significant, can be rectified by an adjustment under 'Effects' and kept in a MediaCoder Preset. The Huffyuv has a much larger file size, takes approx twice as long for its conversion and is slower to import into Premiere.

Note 2: even though the resultant rates for MPEG2, MPEG4 and WMV8 easily exceed the benchmark value (3 Mbps), indicated in section 3, the values are relatively small. Hence, it would be wise to leave the video bitrate for their conversion in MediaCoder at maximum ABR, as specified in section 8.
Note 3: as mentioned above, the video bitrates achieved when maximum ABR is set depends on the level of detail of the source file. It's as if the encoder creates at a rate that it 'decides' is needed in order to efficiently reproduce all the detail. The interlaced source file used above, from a DVD, was converted to MPEG2 and 'maximum' gave 6.8 Mbps and, presumably, a quality file with finer detail and, hence, requiring more, would be converted at a higher rate. To confirm this, I went to the other extreme and randomly selected 12 FLV files for conversion. Using the above settings, except that de-interlacing was disabled, since already progressive, the resultant MPEG2 files had rates between 1.8 Mbps and 4.3 Mbps depending on content.

7. Format Choices that Work for Blu-ray discs
The preamble given in section 6 also applies here.
The difference is that I converted to fames of 1280x720 pixels at both 25 and 29.97 fps, to suit a Premiere project for 720p25 or 720p30, respectively, and to frames of 1440x1080 pixels for projects in 1080p25 and 1080p30.

The DV Video Codec is not appropriate here (see section 5) and I won't give details for the WMV8/PCM combination since its behaviour and clarity was relatively the same as found for the DVD sizes (above).

As I do not have access to any HDV files, the results below were based on an interlaced MPG source file from a DVD. Hence, since the file sizes and the achieved video bitrates depend on the source file, the values given can be indicative only. Moreover, I make no comment as to video quality other than the fact that their relative appearance in Premiere was as found for a DVD (section 6). And, as noted above, the Huffyuv file at 1440x1080 would not display in Premiere CS3!

The file sizes and resultant video bitrates with max ABR set for the 720p formats were (in build 4640):
* Huffyuv/AVI ........ 1510 MB/min (video at 209 Mbps)
* MPEG2/MPEG2 ...... 106 MB/min (video at 14.4 Mbps).
* MPEG4/AVI ............88 MB/min (video at 12.2 Mbps).

And for the 1080p:
* Huffyuv/AVI ........ 2490 MB/min (video at 347 Mbps)
* MPEG2/MPEG2 ...... 142 MB/min (video at 19.3 Mbps).
* MPEG4/AVI .......... 124 MB/min (video at 17.2 Mbps).

These rates exceed the benchmark values indicated in section 3 by at least ~50%.

8. Conclusion
For satisfactory outcomes from Adobe Premiere CS3, I suggest the following settings in MediaCoder:
* 'Enable' De-interlace = Cubic Interpolation (your choice) if the source file is interlaced, else 'Disable' (see section 2)
* Video Format = MPEG4 (this is my preference), Huffyuv or MPEG2 (its up to you)
* for MPEG4 or MPEG2 video, set “Maximum interval between Keyframes” = 12 (see section 3)
* Video Mode/Source/Encoder = ABR at Max/MEncoder/FFmpeg
*Audio Format = MP2 at 128 kbps for MPEG4 and MP2 or PCM for Huffyuv
* Audio Encoder/Source/Resample = FFmpeg/Auto/44,100 Hz
* Container = AVI for the MPEG4 or Huffyuv Codecs or MPEG2 for the MPEG2 Codec (Format)
* Multiplexer = Disabled
* Picture Resize = 720x480 (or 720x576 for PAL), 1280x720 or 1440x1080
* Frame rate = 25 (PAL) or 29.97 (NTSC) fps
* suggest Crop = Expand to Fit, but see: viewtopic.php?f=17&t=8188&start=0
* suggest Aspect Ratio = Keep Pixel AR, but see: viewtopic.php?f=17&t=8197&start=0

Note 4: my preference is MPEG4/MP2 in AVI as above, which I routinely use to convert all FLV files and video from DVDs, preferably via its IFO or Add Track in MediaCoder or, if I must, from its VOBs. This combination has worked in every build of MediaCoder I have tried.

Good luck!