# Export H264 Multipass with custom bitrate

**URL:** <https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335>\
**Category:** Flame Questions\
**Tags:** export, h264\
**Created:** [May 9, 2023, 3:24pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335 "2023-05-09T15:24:43Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/shiver/32/1121_2.png) [@shiver](https://forum.logik.tv/u/shiver)\
**Post date:** [May 9, 2023, 3:24pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/1 "2023-05-09T15:24:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zorrofx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/zorrofx/32/949_2.png) [@zorrofx](https://forum.logik.tv/u/zorrofx)\
**Post date:** [May 9, 2023, 3:32pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/2 "2023-05-09T15:32:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shiver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/shiver/32/1121_2.png) [@shiver](https://forum.logik.tv/u/shiver)\
**Post date:** [May 9, 2023, 3:54pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/3 "2023-05-09T15:54:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Josh\_Laurence](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/josh_laurence/32/1243_2.png) [@Josh\_Laurence](https://forum.logik.tv/u/Josh_Laurence)\
**Post date:** [May 9, 2023, 4:08pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/4 "2023-05-09T16:08:56Z")

</div>

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

> [@Mp4 Export](https://forum.logik.tv/t/mp4-export/6969/4):
>
> 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…

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.

---

<div class="post-metadata">

**Author:** ![shiver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/shiver/32/1121_2.png) [@shiver](https://forum.logik.tv/u/shiver)\
**Post date:** [May 9, 2023, 5:27pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/5 "2023-05-09T17:27:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jeff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/jeff/32/9305_2.png) [@Jeff](https://forum.logik.tv/u/Jeff)\
**Post date:** [May 9, 2023, 8:25pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/6 "2023-05-09T20:25:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![PlaceYourBetts](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/placeyourbetts/32/6852_2.png) [@PlaceYourBetts](https://forum.logik.tv/u/PlaceYourBetts)\
**Post date:** [May 10, 2023, 12:02am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/7 "2023-05-10T00:02:10Z")

</div>

Hey Jeff,  
You know a little about ffmpeg? Or you have access to someone who does 🤗  
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.

---

<div class="post-metadata">

**Author:** ![milanesa](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@milanesa](https://forum.logik.tv/u/milanesa)\
**Post date:** [May 10, 2023, 1:31am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/8 "2023-05-10T01:31:53Z")

</div>

Here is an excellent tool.

> **[GitHub - jedypod/generate-dailies: Daily is a tool to transcode scene-linear...](https://github.com/jedypod/generate-dailies)**
>
> Daily is a tool to transcode scene-linear openexr images into display-referred quicktime movies. - GitHub - jedypod/generate-dailies: Daily is a tool to transcode scene-linear openexr images into d...

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.

---

<div class="post-metadata">

**Author:** ![milanesa](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@milanesa](https://forum.logik.tv/u/milanesa)\
**Post date:** [May 10, 2023, 2:19am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/9 "2023-05-10T02:19:16Z")

</div>

This is also a great source of ffmpeg info

> **[Introduction](https://richardssam.github.io/ffmpeg-tests/)**
>
> This site is focused on testing ffmpeg encoding standards for VFX review.

---

<div class="post-metadata">

**Author:** ![Jeff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/jeff/32/9305_2.png) [@Jeff](https://forum.logik.tv/u/Jeff)\
**Post date:** [May 10, 2023, 3:54pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/10 "2023-05-10T15:54:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![milanesa](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@milanesa](https://forum.logik.tv/u/milanesa)\
**Post date:** [May 10, 2023, 4:04pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/11 "2023-05-10T16:04:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PlaceYourBetts](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/placeyourbetts/32/6852_2.png) [@PlaceYourBetts](https://forum.logik.tv/u/PlaceYourBetts)\
**Post date:** [May 10, 2023, 6:14pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/12 "2023-05-10T18:14:03Z")

</div>

Thanks @milanesa  
I appreciate those links.

---

<div class="post-metadata">

**Author:** ![AdamArcher](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/adamarcher/32/3529_2.png) [@AdamArcher](https://forum.logik.tv/u/AdamArcher)\
**Post date:** [May 10, 2023, 11:28pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/13 "2023-05-10T23:28:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![john-geehreng](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/john-geehreng/32/7195_2.png) [@john-geehreng](https://forum.logik.tv/u/john-geehreng)\
**Post date:** [May 11, 2023, 2:41am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/14 "2023-05-11T02:41:33Z")

</div>

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?

 ![Screen Shot 2023-05-10 at 10.12.10 PM](https://us1.discourse-cdn.com/flex020/uploads/thedepartmentofexternalservices/original/2X/1/15114851a07dc1087d11755145b5ad4d0131ce45.jpeg)

---

<div class="post-metadata">

**Author:** ![kily](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kily](https://forum.logik.tv/u/kily)\
**Post date:** [May 11, 2023, 8:45am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/15 "2023-05-11T08:45:03Z")

</div>

> [@john-geehreng](#):
>
> Would anyone use this if I updated it?

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.

---

<div class="post-metadata">

**Author:** ![milanesa](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@milanesa](https://forum.logik.tv/u/milanesa)\
**Post date:** [May 11, 2023, 9:36am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/16 "2023-05-11T09:36:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![john-geehreng](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/john-geehreng/32/7195_2.png) [@john-geehreng](https://forum.logik.tv/u/john-geehreng)\
**Post date:** [May 11, 2023, 7:39pm UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/17 "2023-05-11T19:39:16Z")

</div>

> [@kily](#):
>
> 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.

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](https://forum.logik.tv/uploads/short-url/jY3jxh2mDYqVXACVbSOMObbrGkW.py) (20.1 KB)

---

<div class="post-metadata">

**Author:** ![john-geehreng](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/john-geehreng/32/7195_2.png) [@john-geehreng](https://forum.logik.tv/u/john-geehreng)\
**Post date:** [May 12, 2023, 1:19am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/18 "2023-05-12T01:19:51Z")

</div>

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](https://forum.logik.tv/uploads/short-url/6QS8GNnmKRqaL3EJ1A10D5ytg8b.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 #

---

<div class="post-metadata">

**Author:** ![kily](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@kily](https://forum.logik.tv/u/kily)\
**Post date:** [May 12, 2023, 10:14am UTC](https://forum.logik.tv/t/export-h264-multipass-with-custom-bitrate/8335/19 "2023-05-12T10:14:31Z")

</div>

Thanks john. I have been studying they both last two months 🤪. 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.
