[FFmpeg-devel] [PATCH] libavformat/mxfenc.c: added mxf opatom muxer

Mark Reid mindmark at gmail.com
Thu Jan 29 04:44:20 CET 2015


hi,
This patch enables ffmpeg to mux mxf files with OP-Atom structure (SMPTE 390M).
opatom files have the same metadata as regular mxf files, but the essence data is stored
in a different way. They can only have 1 stream and essence data is stored continuously
in a single klv packet (clip wrapped), as opposed to each frame in a separate
klv packet (frame wrapped). The essence data must also be stored in a single body partition and
an index segment must be in the footer partition. I've implemented the muxer similar way that the mxf_d10
was implemented, with a new format called "mxf_opatom".

With this patch ffmpeg is able to generate dnxhd/dv mxf files that are compatible with avid media composer
and can be placed in /Avid MediaFiless/MXF/1 folder and be found via its media tool, (though the files
won't contain any useful metadata at the moment). This is the same as libmxf's writeavidmxf
example workflow. I haven't figured out how to generate avid compatible h264
and mpeg2 files yet, but the generated files are demuxable by ffmpeg. Audio also doesn't
work at moment because mxf_write_header current doesn't allow the first stream to be audio.

example usage:

# DNXHD
ffmpeg -f lavfi -i "testsrc=size=1920x1080:rate=23.97" -frames:v 100 -f mxf_opatom -vcodec dnxhd -pix_fmt yuv422p -vb 36M dnx.mxf

# DV
ffmpeg -f lavfi -i "testsrc=size=720x480:rate=29.97" -frames:v 100 -f mxf_opatom -vcodec dvvideo -pix_fmt yuv411p dv.mxf

# Mpeg2
ffmpeg -f lavfi -i "testsrc=size=720x480:rate=29.97" -frames:v 100 -f mxf_opatom -vcodec mpeg2video -q:v 1 -qmin 1 -intra -pix_fmt yuv420p mpeg.mxf

# H264 AVC intra 100 I think...
ffmpeg -f lavfi -i "testsrc=size=1920x1080:rate=25" -frames:v 100 -s 1920x1080 -f mxf_opatom -vcodec libx264 -intra -vb 100M -pix_fmt yuv422p h264.mxf

I'm not entirely sure if all the essence container uls are correct as I'm just using the ones
from the existing muxer. They might need to be clipwrapped versions or something else but I haven't looked into it yet.

Mark Reid (1):
  libavformat/mxfenc.c: added mxf opatom muxer

 libavformat/allformats.c |   1 +
 libavformat/mxfenc.c     | 139 ++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 127 insertions(+), 13 deletions(-)

-- 
2.2.1



More information about the ffmpeg-devel mailing list