Mp4 Export

Hi,

Can we export mp4 from Flame?

no
Edit: I have not seen the details of the latest release, so that may have changed.
2nd Edit: no

2 Likes

Hey there Deepak,

A few months ago I asked the same question you’ve asked with my coworker @Josh_Laurence and with the immeasurable help of @ManChicken we discovered that the answer is indeed yes.

The reason I haven’t really published my findings to the community at large is because there are a few caveats and “holes” that I haven’t quite figured out, but we’re currently using it to wonderful success every day here at Assembly. Big caveat- this is for Rocky Linux. I would think it works with a few adjustments for Mac. mostly the ffmpeg part, but my guide here is not for Mac because I am not on a Mac.

The way this works is by exporting an .mov H264 from Flame from a carefully configured “Profile” file that makes a nicely compressed .mov H264 via a .cdxprof file. I say nicely because the default profiles that come shipped with Flame I found do not create H264s that are both “main” and “cbr” which is where I would lean if I were making these files using other means (Media Encoder for example). I made 3 for 3 different commonly used bitrates. They are zipped up in this zip here:

MP4_cdxprof.zip (2.6 KB)

They should be loaded to this location:

/opt/Autodesk/mediaconverter/2023.1/profiles/Quicktime/video/H264/

Then, load these 3 Export Preset .xml files to this location:

MP4_H264_5mbps.xml (1.8 KB)
MP4_H264_10mbps.xml (1.8 KB)
MP4_H264_20mbps.xml (1.8 KB)

/opt/Autodesk/shared/export/presets/movie_file/

These .xml presets were created in Flame and use the above profiles to create a .mov h264. You can create your own, you just have to ensure you adjust the python script we’ll be getting to in a moment.

Now you load the python hook to the python location:

/opt/Autodesk/shared/python

remux-to-mp4.py (2.0 KB)

This is the brilliant work of Bob Maple who did all of the heavy lifting on python to make this a reality. This hook looks to see if you have used the above mentioned .xml Export Presets, and if so, it uses ffmpeg to re-encode the .mov h264 into an .mp4 h264 and then deletes the .mov to clean things up. I toyed with the idea of circumventing ffmpeg and simply renaming the .mov to .mp4, but you run several metadata related risks if your delivery requires .mp4’s. The video codec portion passes through; however, the bug we could not solve is that we must re-encode the audio. When we didn’t re-encode the audio with ffmpeg, we found the audio would go out of sync. This is the part of the workflow that if someone else can figure out why and how to avoid this, I would love to not have to re-encode the audio. But for now, this is a necessary evil that I have come to terms with, and I don’t think it’s all that bad.

Finally, confirm that ffmpeg is installed on your system by running this command:

man ffmpeg

If nothing happens, then install ffmpeg:

sudo dnf -y install https://download.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum-config-manager --enable powertools
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm -y
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm -y
sudo dnf install -y ffmpeg
sudo dnf -y install ffmpeg-devel
rpm -qi ffmpeg

Once all of that is done, whenever you use the shared preset “MP4_H264” to export something, the python hook will come into play and convert your .mov into an .mp4 automagically. As we talked about, the only pitfall right now is that we need to double encode the audio as .aac–Flame does it and then FFMPEG has to do it too. If you can live with that, then it seems to be working well for me.

And again, I ask the community–if you can figure out how to make this work without double encoding the audio, hat’s off to you. Until then, feel free to ask questions and I can probably answer them since I’ve spent a bit of time with all of this.

12 Likes

I use Jeff’s setup on Mac and it works great.

For Mac the expected location of ffmpeg is slightly different from linux:

– Download the Mac build: Download FFmpeg
– Extract from the zip file
– Using terminal to copy the files to /usr/local/bin:

cd ~/Downloads/
sudo mkdir -p /usr/local/bin/
sudo cp ./ffmpeg /usr/local/bin
sudo chmod ugo+x /usr/local/bin/ffmpeg

After this, in the terminal try:

ffmpeg -help

and you will get the help manual if it was installed correctly.

5 Likes

I have a separate python hook that lets you export from the Media Hub, skip the export dialog, and export straight to a path based on the project, date, time, etc. But I can’t get that one and the mp4 remux to work together. I’m trying to figure that out… It seems like the export from my python hook does not trigger the hook after export that does the remux.

1 Like

Wow. This works really well. Nice timesaver for getting review postings out quickly.

1 Like

And just to clarify for those on Mac, this may be apparent but you’ll have to modify the python script to account for the Mac location of ffmpeg as opposed to the location specified in the python script by default that would be pointing to the Rocky Linux default installation location.

If you’re using the location Bryan specified above, you would change the line that starts with this:

ffmpeg_cmd = ['/bin/ffmpeg'

To this :

ffmpeg_cmd = ['/usr/local/bin/ffmpeg'
1 Like

Lovely!!

Thanks Jeff, will check it out.

1 Like

For the adventurous one here is a great tool to generate movies out of image sequences:

I use it to automatically generate Rec709 (dailies) and ACEScct (for grading) movies out of EXRs.
Is fairly flexible as is based on presets you can set in a config file.
It includes the option to process color spaces with OCIO.
It support Mp4, MOV, HEVC, ProRes, DNH… etc
I belief it can also do a simple text slate.

1 Like

I ended up making one script that combines the two tasks I was attempting. If anyone is interested I can share it here but you will need to know enough python to modify some lines to suite your facility’s folder structure.

@bryanb that would be very useful please

@johnt Hey I think you’d actually be better off using John Geehreng’s script. It will help you set up the export path and other things that you would have to manually edit in my script:

1 Like

Thanks for your reply. I saw this the other day and it looked ace.

1 Like