{"id":24584,"date":"2015-07-29T08:49:06","date_gmt":"2015-07-29T07:49:06","guid":{"rendered":"http:\/\/johnwarburton.net\/blog\/?p=24584"},"modified":"2015-07-29T09:06:09","modified_gmt":"2015-07-29T08:06:09","slug":"converting-avid-meridien-mjpeg-media-with-ffmpeg","status":"publish","type":"post","link":"https:\/\/johnwarburton.net\/blog\/?p=24584","title":{"rendered":"Converting Avid Meridien MJPEG media with FFmpeg"},"content":{"rendered":"<p>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.<\/p>\n<p>Meridien MJPEG files, whether wrapped as MXF or OMF, are signalled as full-range (0 \u2013 255) files, but in fact they contain limited range (16 \u2013 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.<\/p>\n<p>Remember also that Avid&#8217;s Meridien files contain 16 blank lines at the top for VBI information. These need to be cropped.<\/p>\n<p>There is a simple solution, using FFmpeg&#8217;s scaler. For SD 576-line files (&#8220;PAL&#8221; standard), include, early in the video filter chain, this:<\/p>\n<p><code>scale=src_range=0:dst_range=1,crop=x=0:y:16:w=720:h=576<\/code><\/p>\n<p>For 480-line (&#8220;NTSC&#8221; standard) files, use this:<\/p>\n<p><code>scale=src_range=0:dst_range=1,crop=x=0:y=16:w=720:h=480<\/code><\/p>\n<p>A full command line to convert a UK television picture might be:<\/p>\n<p><code>$ 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<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 \u2013 255) &hellip; <a href=\"https:\/\/johnwarburton.net\/blog\/?p=24584\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Converting Avid Meridien MJPEG media with FFmpeg<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,3],"tags":[],"class_list":["post-24584","post","type-post","status-publish","format-standard","hentry","category-encoding","category-film-making"],"_links":{"self":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/24584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24584"}],"version-history":[{"count":4,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/24584\/revisions"}],"predecessor-version":[{"id":24592,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/24584\/revisions\/24592"}],"wp:attachment":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}