Export H264 Multipass with custom bitrate

Hello Everybody,

On Mac, how to have more options to customize H264 export ?

Like choose bitrate / Multipass / profile…
I use Baseline 20Mbs but it’s not enough (too compressed).
I don’t want to export Masters and use Resolve after to load each masters and export again in H264.

Is there any way to do it Inside Flame with Python script ?
I read FFMPEG is a part of the solution.
I’m a bit newbie with Python so…

Thank you

I just leave the encoding to part Adobe’s Media Encoder. It’s not fast but has the control I need

1 Like

Adobe Encoder is an option…
But could we stay in Flame ?

@ManChicken and @Jeff did an amazing script that makes .mp4s. Check this out:

You’ll notice there are custom .cdxprof settings in there. You can absolutely make your own using the variables in there i.e. increasing the bitrate of the export…

I’ve gotten this to work brilliantly on my Macintosh, but had to install ffmpeg which took a little sleuthing.

1 Like

Oh great ! I install it.
Thank you Josh and @ManChicken and @jeff

1 Like

There are obviously quite a few steps but I feel pretty familiar with them, aside from some potentially complicated ffmpeg installation stuff; that can get dicey sometimes and I don’t know everything there is to know about that beast of a toolset. Let me know if you run into any other hurdles along the way and I’d be happy to help!

Hey Jeff,
You know a little about ffmpeg? Or you have access to someone who does :hugs:
Would you have any idea how to use ffmpeg to go from ACEScg EXRs and make ProRes?

We are tying to use Deadline to make .movs from our renders but the movs need some colour management. Deadline is using ffmpeg and I was wondering how i might go about tweaking some settings. Our EXRs are being rendered ACEScg (AP1) and it looks like the proRes are expecting AP0

It’ll need to go through a colour conversion. AP1 - AP0 - sRGB/rec709 preRes.

Not fussed if they come out sRGB or rec709.

Here is an excellent tool.

Have used it many times with great success!

It uses OIIO and OCIO to do the conversions. You may be able to learn something from the way is done there.

1 Like

This is also a great source of ffmpeg info

2 Likes

I’m no ffmpeg expert. I’m not even a little good. I know how to get in and out but that’s about it. I’m thinking Abel’s solution is looking pretty good! Hope that does the trick.

1 Like

When I get some time I’ll extract some command lines. Keep in mind you will need Open Color IO and Open Image IO (maybe just OIIO) available in your systems. I am on linux, but I think you can install those on OSX via Homebrew.

1 Like

Thanks @milanesa
I appreciate those links.

1 Like

It’s times like these that I really miss Episode.

It was awesome being able to remote into Flame and export directly from the Framestore.

2 Likes

Those links had the missing pieces I needed to get my old mp4_gui script exports to match what’s in Flame (at least with Rec709 material). Thanks for sharing them!

Would anyone use this if I updated it?

5 Likes

Yesss. I’ve been almost obsessed with writing a hook to export mp4 that fits my needs. I’m trying to do something on my own with my limited python knowledge taking your hook as a base. But it would be great if you would like to update it in some way.

Here is an example using OIIO and FFMpeg. This create a Rec709 Prores422HQ movie out of an ACEScg EXR sequence.

oiiotool image.%04d.exr --stats --colorconfig $OCIO --iscolorspace "ACES - ACEScg" --tocolorspace "Output - Rec.709" --resize 1920x1080 --autocc --threads 0 -o temp_img.%04d.png ; ffmpeg -y -f image2 -start_number 1001 -i temp_img.%04d.png -c:v prores_ks -profile:v 3 -vendor apl0 -qscale:v 7 -pix_fmt yuv422p10le -vf fps=23.97 -color_primaries bt709 -color_trc bt709 -colorspace bt709 movie.mov ; rm temp_img.*.png

The command assumes that OCIO environment variable is set to an ACES 1.3 config.

Unfortunately it seems like oiiotool doesn’t fully support piping out image data, so this example is doing the conversion in two steps. It generates a sequence of pngs and thencreates the movie out of it. After the movie is created, the pngs are deleted.
The generate-dailies tool above solves this by using OIIO python bindings. It is a more elegant solution, but I want to leave python out for this example.

One thing I didn’t check is the quality of the PNGs. This may be something that can be tweaked. Also the ffmpeg arguments may be tweaked for better results. That secon link above will help there.

3 Likes

Hey @kily. It’ll take me some time before I can update the UI. In the meantime, you could try this script. It’s a copy of ADSK’s “export_selection” script with some changes to make mp4’s. I’ve tested it in 2024, but I think it should work in 2022 and above as long as ffmpeg is installed. I’d recommend a homebrew install if you’re on a Mac.

If you want to customize it, look for:

  • “default_path” on line 58. This controls the where the browser will open.
  • “crf_entry” on line 212. The controls the video quality. “0 being Lossless, 51 being terrible, and 17 or 18 being the sweet spot.”
  • “320k” on line 220. Audio Quality.
  • “localhost” on line 383. You might have to change it depending on what Backburner Manager you’re using.
  • ’ /opt/Autodesk/python/2024/bin/python3 -c "’ Check the version on line 354.

logik_export_selection.py (20.1 KB)

Here’s the gui version. It’s the old UI, but it’s working in 2024 so I have no plans to update it.
mp4_gui.py (52.0 KB)

You still might need to search for and modify these things:

  • “localhost” - replace it with your Backburner Manager
  • “2024” - Do a find and replace with your version #
1 Like

Thanks john. I have been studying they both last two months :crazy_face:. I decided stop and study Python in the most conscientious way possible. I have improved a lot and I understand the code better. Each hook of those two has different things that I like and my goal is to have something that fits what I like. But I’m still at a bit of anoob point and that’s why I think that any improve from someone who really knows will be better.