Converting Avid Meridien MJPEG media with FFmpeg

One of the older native codecs in Avid, the Meridien motion-JPEG (MJPEG) codec, can be read by the FFmpeg utility and, therefore, converted into other more popular codecs and wrappers. However, there is a caveat concerning the luminance levels.

Meridien MJPEG files, whether wrapped as MXF or OMF, are signalled as full-range (0 – 255) files, but in fact they contain limited range (16 – 235) data, leaving room for super-white and super-black excursions. Their pixel format is read as yuvj422p but, in conversion to the usual yuv420p used for most consumer-oriented formats, the range is reduced yet again. So, this must be prevented.

Remember also that Avid’s Meridien files contain 16 blank lines at the top for VBI information. These need to be cropped.

There is a simple solution, using FFmpeg’s scaler. For SD 576-line files (“PAL” standard), include, early in the video filter chain, this:

scale=src_range=0:dst_range=1,crop=x=0:y:16:w=720:h=576

For 480-line (“NTSC” standard) files, use this:

scale=src_range=0:dst_range=1,crop=x=0:y=16:w=720:h=480

A full command line to convert a UK television picture might be:

$ ffmpeg -i VIDEO.mxf -i AUDIO.wav -vcodec libx264 -acodec libfdk_aac -vf scale=src_range=0:dst_range=1,crop=x=0:y=16:w=720:h=576,setdar=16/9 -aspect 16:9 VIDEO-AND-AUDIO-H264.mkv

Useful Avid Media Composer Console commands

While waiting for a file to convert, I typed help commands into the Avid console. These might be useful to some Avid users. There are many, many more.

The command every Avid user should know is subsys monpane debug, allowing precomputes and other unusual media to be loaded directly into the composer window, and used as edit sources.

These console commands are from Media Composer 8.2.2. Later versions may vary.

Access the console from the “Tools” menu, or by typing CTRL-6 or COMMAND-6.

AllDrives 1

Makes all drives act as media drives

AllDrives 2

Makes all drives behave normally

AllowCrossRateTranscode

This is a toggle setting. It produces the warning: “Clips created using the cross-rate transcode feature can only be used for playback. The newly generated media is valid for playback, but the clips cannot be used with many operations. They are not supported by operations such as Modify, Relink, Batch Capture, Batch Import, Decompose, Import/Export, and use within the Interplay environment.

AllowUNCWrite

This is a toggle. Permits Avid to write to shares on Windows-style networks that are not mounted as drive letters such as \\OFFLINE_001\MyDirectory\Filename.mov

AMA_SetLoggingLevel

0x0 = Errors, 0x01 = Warnings, 0x02 = Verbose, 0x04 = Trace, 0x08 = Info, 0xff = All

answer

Create a pop-up asking a question with up to three click-button choices, and return the result. Example answer "How many beans make five?" with "One" OR "Two" OR "Five"

asiocontrol

Opens your ASIO control panel for audio I/O. If you don’t use this interface, your operating system’s audio control panel opens.

audioextras

Enable or disable extra audio features. A dialogue box appears.

Disable3D

Disables some OpenGL code. May be useful for older video adapters.

Enable3D

Re-enables some OpenGL if earlier disabled with Disable3D

ForceHDTranscode

True: forces transcode of HD media to SD before export; False: makes transcoding of HD media optional before export

HDTitleFilter

A toggle: controls the filtering of HD titles during downconversion to SD

IgnoreQTRate

For video-only QuickTime files: ignores file frame rate, and imports file frame-by-frame. Otherwise, QuickTime files with frame rates different from your project are imported with a crude frame-dropping or frame-repeating speed-change added. You’ll see this a lot in cinema films where television archive has been incorrectly imported.

LegacyOverlay

Off: use best desktop video overlay method advertised by OS. On: use older methods for graphics adapters with incomplete OpenGL implementations. In case of failure (e.g. Avid not starting) hold “L” and “O” at power up to force this mode once, then enter the console command.

MulticamPreload

Changes preloaded frames for multicam editing. May reduce stuttering.

RenameMediaFiles

Without any arguments, renames ALL files within Avid MediaFiles to more accurately reflect the project name and clip name.

ResampleCapturedAudio

May be useful during ingest if someone has recorded a DV tape with 32kHz sampled audio

subsys monpane debug

Puts the Monitor pane subsystem into debug mode. Very useful: allows precomputes and raw media files to be displayed and edited into timelines.

TCBreakTolerance

Alter Avid’s tolerance to timecode skips. Currently, anything under than 7 frames starts a new clip

Play Avid Meridien MXF or OMF with FFplay

You may have found an old Avid drive containing MXF or OMF files compressed with Meridien codecs. Sometimes these are known by their compression ratio, e.g. “2:1” or “14:1”.

Because of the combination of the MXF/OMF container and the Meridien codec, rarely found in modern software apart from Avid, these files can be difficult to play, even if your QuickTime installation contains the Avid-distributed codecs.

So how can you view these files for free?

Easy. Avid Meridien compression is actually MJPEG – Motion JPEG compression. The free and open-source utility FFmpeg has a sister player: FFplay. Even though it doesn’t know how to find an MJPEG codec inside an MXF OP1A wrapper, or an Avid OMF wrapper, you can tell it what to do with a simple command line. Then, you can view any Meridien-compressed MXF or OMF files on your drive.

As a guide, MXF video files are named in the following way:

CLIPnameVnn.<ID>_<ID>.mxf

ID” is a hexadecimal string that Avid uses to track the media. The pattern for OMF files is similar.

When the letter ‘V’ follows a clip name, and is succeeded by a pair of digits, you’ve found a video file. Then, the command to play it is:

ffplay -f mjpeg CLIPV01.<ID>_<ID>.MXF

The trick is the “-f mjpeg” in the command line. This forces FFplay to interpret the file as containing data encoded as Motion JPEG.

And now you can see your pictures. They’ll play with the VBI data included, and the colour range may appear washed out because you’re displaying broadcast-level pictures on a computer-level display.