Personal View site logo
Using ffmbc (FFmpeg for broadcast) for AVCHD rewrapping & conversion
  • Hi. I am on a mac and I want to rewrap my spaned .MTS files into single .mov files, and sometimes I want to convert my .mts files into DNxHD and Prores. I have different issues with Clipwrap and 5DtoRGB and want to use ffmbc (FFmpeg designed for video broadcast users) but I have to admit I find the installation and use confusing.

    Can somebody please post here how to download, configure, compile, and use within the terminal ffmbc to rewrap MTS files and convert to Prores/DNxHD? I am personally interested in Mac OS X but others may need this for windows also.

    Thanks so much!!!

    @sampledi

  • 28 Replies sorted by
  • First install Yasm - Download and install the Xcode Developer Tools - Download, compile, and install a current version of yasm: Open up the Terminal and type the following: curl http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz> yasm-1.2.0.tar.gz tar -xvf yasm-1.2.0.tar.gz cd yasm-1.2.0/ ./configure ; make When that finishes, you'll need to install yasm. Type the following: sudo make install (You'll need to enter your system password at this point and hit return) Once yasm is installed, clean up by typing: cd ../ rm -rf yasm-1.2.0 yasm-1.2.0.tar.gz

    Than you'll have to compile FFMBC

    Download the latest tarball from here http://code.google.com/p/ffmbc/downloads/list Unzip the unzipped tarball in a terminal window with 'tar xvf /Users/Rainer/Downloads/FFmbc-0.6-rc3.tar' Change directories to the newly created FFMbc directory,  'cd FFmbc-0.6-rc3' Type './configure --enable-gpl --enable-gpl --enable-runtime-cpu --enable-sram' to configure (details may vary, depending what you want enabled) Then type 'make' to compile. After some time compiling, when you get a command prompt, type 'sudo make install' That will install FFmbc for you, and set permissions and so forth.

    DNxHD conversion example: ffmbc -i 00000.MTS -vcodec dnxhd -b 175M -acodec pcm_s16le -ar 48000 -ac 2 -threads 4 converted.MOV

  • :( sorry but formatting is not working from some reason, so it will be hard to read the text above

  • Great thanks so much for the extensive response. I have been looking in the documentation and other forums but this is much more helpful.

    What about if you have spanned clips and want to rewrap them into a single .mov file without transcoding? AVCHD folder from GH2, PRIVATE/AVCHD/BMDV/STREAM/00001.MTS, 00002.MTS, 00003.MTS all parts of one clip. How do I take these three and rewrap them into a .mov file, that I can then send to 5DtoRGB, Resolve Lite, a NLE, etc using the command line of FFMBC?

  • It is doable but you can also use MTSmerger as a first step. Also, I forgot to mention that re-wrapping to .mov often have some issues, so I'm usually re-wrapping to MP4. What's your workflow, what are you trying to achieve with re-wrapping?

  • I think MTSmerger is Windows only right? Wrapping to .mp4 is a good tip.

    My immediate purpose is to rewrap spanned MTS files so that 5DtoRGB can read them and convert them. Thomas said that one of the next updates should include Mac OS X DNxHD export and spanned clips support, but until that I need to merge/rewrap them myself to prep for 5DtoRGB, and he suggested MPEGStreamclip.

    Then I will export to either Prores or DNxHD, still trying to decide which of those editing codecs I am going to use. Ideally I would like to use DNxHD .mov files since they are self-contained and easier to trim&organize, and I will be working mostly in Media Composer 6 and Premiere 5.5. However I seem to have more trouble getting to DNxHD then I do to Prores using my Mac, with gamma issues etc.

  • If I'm not mistaken something like ffmbc -i 00000.MTS -i 00001.MTS ...(putting all clips in sequence) should work. If you plan to use DNxHD QT files in PP - don't! Especially last two codec versions. For MC ... converting to QT via 5DtoRGB, than fast importing / re-wrapping to MXF is very slow process with double amount of data on HDD. But I understand that you want maximum from your footage.

  • DNxHD Quicktime files don't play well in Premiere Pro 5.5 ? Do the MXF ones play well?

    Also, if I transcode everything to DNxHD .mov files, will those not play in Media Composer? Are you saying I will have to re-wrap them AGAIN to MXF? In that case I should just go to MXF directly. I wish I could just transcode with Media Composer's built in import tools...

    For some reason I think that MXF files will be more complicated to organize in the file browser in OS X then having nice neat individual .mov files. But maybe I should abandone that thinking..

  • Something is wrong with DNxHD QT implementation in last two versions. I've described some issues here: http://forums.creativecow.net/readpost/45/884228 And there is more, especially if you are doing green screen or more demanding VFX. Also performance of DNxHD QT in Premiere is poor compared to XDCAM HD422 or AVCintra MXFs for example. Considering Avid MC - you can work with DNxHD QT via AMA, but that's not full Avid experience. And of course you can transcode GH2 material inside MC. Just don't do that via import function and with MTS files. Simply re-wrap files to MP4 when you are copying your card to HDD. Than AMA those MP4 files and finally Consolidate/Transcode.

  • Merge mts files with TXMuxer: Mac Download http://www.videohelp.com/download/tsMuxeR_1.10.6.dmg

    Mts to (mp4 container)/mov or avi wrapper is easy & practically lossless with MediaCoder but Windows only, sorry: http://lightworks.wikidot.com/avchd-workflow or try Handbrake (Mac version): http://handbrake.fr/downloads.php

  • @Roberto, Nityananda_SCSMath question was about FFMBC, not FFMPEG. There are couple of free GUI tools on OS X that can rewrap MTS files, but they are all using FFMPEG. For FFMBC you have to do it via terminal.

  • you can combine spanned .MTS files before using any software just by using cat in the terminal because they are literally just a stream of data. for example "cat 00002.MTS 00003.MTS 00004.MTS > OutputFile.MTS"

  • I use a windows .cmd script to do this, this could be changed to run in the apple shell I am sure. (Sorry my *nix scripting is rusty and I don't know what the mac uses for a shell anyways)

    md mts md mov

    for %%f IN (*.mts) DO ( "C:\Program Files\ffmbc\ffmbc.exe" -i %%f -sameq -vcodec copy -acodec aac -strict experimental %%~nf.mov )

    move *.mov "mov\" move *.mts "mts\"

  • It is similar in OS X:

    for I in *.MTS do ffmbc -i "$I" -vcodec copy -acodec aac -strict experimental -ab 512k "${I%.MTS}.mp4"

  • @sampledi

    Thanks for correcting my hasty speed-reading - and for introducing me to this fantastic utility! I have just installed FFmbc on my Linux machine and it's changed my future work flow plans.

    ProRes encoding notes were added to the Wiki yesterday.

    @Nityananda_SCSMath "Please join Freenode irc channel #ffmbc for online help"

  • I have been using the "cat" command and sending the files to 5DtoRGB for prores encode (no DNxHD on mac,) then AMA them to DNxHD in Media composer. I have a lot of files so this is a very slow and tedious process.

    "And of course you can transcode GH2 material inside MC. Just don't do that via import function and with MTS files. Simply re-wrap files to MP4 when you are copying your card to HDD. Than AMA those MP4 files and finally Consolidate/Transcode." @sampledi This sounds good+faster, how do you re-wrap the MTS files to MP4 when I am copying the card to the HD? Using what code line with FFMBC? And will this rewrapping to .mp4 work with spanned clips?

    I wonder, is it possible to transcode from the original .MTS files to DNxHD OP-Atom MXF files in one swoop using FFMBC?

    Thanks very much for everyone's help!

  • @Nityananda_SCSMath

    I did not read the entire thread ... but if you want to utilize "ffmpeg" on MAC a very easy way is to use "Media Converter". It contains ffmpeg and comes with a decent GUI.

    http://media-converter.sourceforge.net/

    here you'll find a bunch of DNxHD (and other) presets: http://media-converter.sourceforge.net/presets.html

    My workflow:

    • batch rename MTS files

    • batch convert MTS files through Media Converter to DNxHD (QT mov)

    • add tape names and unique timecode (with "qtChange": http://www.videotoolshed.com/product/42/qtchange ) ... also in batch mode

    • "fast" import into Avid

  • Hi towi, this sounds like a good workflow. Am I correct to say that "fast" importing the DNxHD QT files to MXF OP-Atom files is just a rewrapping and not re-encoding/affecting the image quality?

    Also what do you think about converting from Prores to DNxHD? How much quality loss would this cause from two editing codecs to each other?

  • yes, "fast" import is just a rewrap to mxf without re-encoding. very fast and it does not affect the image.

    re ProRes HQ -> DNxHD (10bit each): I've seen posterization in the blacks quite often. so I generally try to leave ProRes out of my workflow. Avid MC 6 natively supports ProRes. this is why things may look different on V6...

  • forgot to mention...

    if you consider to use qtChange you should use the "export ALE" feature which is specifically designed for Avid MC...

  • Hi towi. Could you give a more detailed explanation of your workflow? "My workflow: batch rename MTS files (Using what, to what kind of names? Why do this?)

    batch convert MTS files through Media Converter to DNxHD (QT mov) (Will this work with spanned files?)

    add tape names and unique timecode (with "qtChange": http://www.videotoolshed.com/product/42/qtchange ) ... also in batch mode (What naming convention do you use for tape names?)

    "fast" import into Avid (I assume this is from the DNxHD QT mov files outside of the "Avid MediaFiles" folder which are then rewrapped and copied into the "Avid MediaFiles" Folder? Then you can delete the original DNxHD movs right?)

    I wonder if this would be better ultimate quality then using 5DtoRGB to prores and then prores to DNxHD, considering the special chroma resampling etc. of 5DtoRGB but knowing that prores-to-DNxHD will affect quality?

    Thanks for your input.

  • @Nityananda_SCSMath

    "batch rename MTS files (Using what, to what kind of names? Why do this?)" - I use "Name Mangler". Naming convetions depend on the type of project. You can for instance simply use "day1_0001", "day1_0002" etc. Or "card1_0001", "card1_0002" etc. Or "blockbuster_sc23_0001", ""blockbuster_sc23_0002". Up to you.

    Why? I don't like to handle files with non significant names (00000) or - if you switch reformatted cards - even using twice or three times the same clip name (and all containing the same timecode if you do not assign unique timecodes to the files). Sooner or later you get totally confused and of course dupe detection doesn't work as supposed to. Too, if you use another software for color grading (for instance roundtrip Avid & DaVinci Resolve), tape names, unique clip names and unique timecode are mandatory.

    "batch convert MTS files through Media Converter to DNxHD (QT mov) (Will this work with spanned files?)" - I don't think so.

    "What naming convention do you use for tape names?" - mostly I use the "folder" option in qtChange. So I first rename the folder (for instance "blockbuster_sc23") and afterwards assign the folder name as "tape name". All files within that folder will then contain the respective tape name and are numbered sequentially. Timcode is ascending from clip to clip.

    ""fast" import into Avid (I assume this is from the DNxHD QT mov files outside of the "Avid MediaFiles" folder which are then rewrapped and copied into the "Avid MediaFiles" Folder? Then you can delete the original DNxHD movs right?) - I would never delete the original files before a project is finished... but yes, generally you are right.

    "I wonder if this would be better ultimate quality then using 5DtoRGB to prores and then prores to DNxHD, considering the special chroma resampling etc. of 5DtoRGB but knowing that prores-to-DNxHD will affect quality?" - try and decide. Sometimes 5DtoRGB will do a better job, but not always. Mostly the gain in IQ is totally negligible (to me). Whereas the poserization in the blacks (going from ProRes to DNxHD) is a pain. Besides, also ffmpeg provides a "high IQ" setting (on Media Converter's presets site these are the presets containing "HQ" in the naming). It has nothing to do with 5DtoRGB's chroma smoothing, but takes much smaller macroblocks into account for the conversion. Processing in "HQ" mode takes AGES, though. I rarely use the "HQ" mode.

    more info on the "HQ" thing:

    http://www.itbroadcastanddigitalcinema.com/ffmpeg_howto.html#Encoding_VC-3

    -mbd : Macroblock decision algorithm ( high quality mode ). simple : Use mbcmp ( default ). bits : Use fewest bits. rd : Use best rate distortion.

  • Thanks for all the info towi. After weeks this is still kind of a headache. Your Media Converter workflow ticks most of the boxes except that it doesn't seem to work with spanned files, although the workaround for this is the "cat" command I suppose.

    Yeah I would rather not go to Prores and then DNxHD better to go straight there. However I hear that using the quicktime engine to transcode to DNxHD is one of the factors that causes IQ problems. For instance the same company that makes qtChange makes a program called "Offloader" that can transcode from spanned .MTS files directly to native MXF DNxHD files. However it uses the quicktime engine to do this which is one of the big things that the 5DtoRGB people and others say is a problem...

    Does Media Converter or the FFMBC workflows use the quicktime engine to do the transcoding or something else? Media composer does not, I know that much.

  • Is it possible to use FFMBC to make DNxHD MXF files and then add your file name, tape name, timecode and thus copy into Avid MediaFiles without rewrapping? And is there any advantage of using FFMBC over using FFMPEG quality-wise etc? I heard somewhere that FFMBC is specially tuned for broadcast conversion of AVCHD content more so then FFMPEG but I don't know if that really applies here..

  • @Nityananda_SCSMath

    "However I hear that using the quicktime engine to transcode to DNxHD is one of the factors that causes IQ problems. (...) Does Media Converter (...) use the quicktime engine to do the transcoding or something else?"

    Yes, you should avoid QT as it mostly introduces gamma and color shifts (not only with DNxHD).

    Media Converter transcodes through ffmpeg (built in into Media Converter).

  • @towi Avid import mts Ok, Why use media converter?