I'm scratching my head trying to work out how to encode Prores files on a Mac using the X264 encoder. Can anyone help me out - can I use ffmpeg, or is it bettter to run via Terminal? Is there some sort of beginner's guide out there?
I'm aiming to produce Blu-ray compliant encodes for import into authoring sofware for commercially pressed discs.
Thanks.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 25 of 25
Thread
-
Last edited by TenementLady; 10th Feb 2021 at 11:53.
-
Thread moved to the mac forum where you can get more help.
I think,therefore i am a hamster. -
Originally Posted by TenementLady
Originally Posted by TenementLady -
Thanks
I do the disc authoring myself too, so I need to be able to make sure the encodes are Blu-ray compliant. I need to know which settings to use based on the various types of film footage etc I'll be encoding. -
Originally Posted by TenementLady
Originally Posted by TenementLady
For command line, see some examples on the web.
Authoring a professional Blu-ray Disc with x264 - x264bluray.com
Google ffmpeg encode for blu-ray -
I've honestly never touched ff-works, but if you don't mind spending some time in Terminal, I can give you the command I use that should produce Blu–Ray compliant files *.264 files for 1080p30 source material.
Code:./ffmpeg -i INPUT.mov -c:v h264 -preset veryslow -b:v 20000k -maxrate 40000k -bufsize 30000k -level 4.1 -pix_fmt yuv420p -x264-params bluray-compat=1:open-gop=1:slices=4:keyint=30:fake-interlaced=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:pass=1 OUTPUT.264
Code:./ffmpeg -i INPUT.mov -c:v h264 -preset veryslow -b:v 20000k -maxrate 40000k -bufsize 30000k -level 4.1 -pix_fmt yuv420p -x264-params bluray-compat=1:open-gop=1:slices=4:keyint=30:fake-interlaced=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:pass=2 OUTPUT.264
All right, so what did we actually just do? First, a bit more information about my source file: My source file is a ProRes4444 video file in an *.mov container. Technically it also has uncompressed 48kHz two channel stereo audio in it, but we don't care about that as we're only focused on the video right now. (The audio could honestly even be 44.1kHz stereo as I won't be using the audio from the ProRes file anyway. Theoretically I could have saved the *.mov file from my editing software with no audio whatsoever.) Keeping everything I've just mentioned in mind, the following information applies only to the video portion of your file.
Code:./ffmpeg
Code:-i INPUT.mov
Pro Tip: Drag the file into the Terminal window if it has a long name, this will save you from having to remember to type a \ every time there's a space. If you like clean code, you can then erase the path before the start of your filename too to keep things neat.
Code:-c:v h264
Code:-preset veryslow
Code:-b:v 20000k
Code:-maxrate 40000k
Code:-bufsize 30000k
Code:-level 4.1
Code:-pix_fmt yuv420p
Code:-x264-params bluray-compat=1:open-gop=1:slices=4:keyint=30:fake-interlaced=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:pass=1
Code:-x264-params bluray-compat=1:
Code:open-gop=1:
Code:slices=4:
Code:keyint=30:
Code:fake-interlaced=1:
Code:colorprim=bt709:
Code:transfer=bt709:
Code:colormatrix=bt709:
Code:pass=1
Code:pass=2
Code:OUTPUT.264
All right, now we have the video, but we still need audio. Typically I would export a *.wav file separately from your editing software just to speed this step up a little, but if you want to split it out of your video file that's always an option too. What's important is that the audio be uncompressed linear PCM at 48kHz. Note that you could use AC–3 or a similar format too, but LPCM is probably the most standard these days, so that's what I use. I'm not sure what your editing software is, but this next step is kind of required if you're using Adobe Premiere Pro. Download and install Audacity; it's small, free, and available under the VideoHelp "Tools" section of the site. Take your *.wav file, open it in Audacity, and save it again. At this point you should be prompted for metadata info. Delete all of the metadata fields that you can remove completely and empty out the others as best you can. Once you've named and saved your new *.wav file, you should be good to go.
The reason for the *.wav file with the metadata removed boils down to tsMuxer (the software we'll use to create an *.m2ts file like the ones on a Blu–Ray Disc for testing purposes,) not being able to handle a *.wav file directly from Adobe Premiere Pro/Media Encoder, seemingly as a result of the metadata that Adobe adds. If you leave this in your audio will sound fine until the last second or so of your video, upon which you'll be greeted with a LOUD buzzing sound that'll drive you insane and maybe break some speakers. This isn't something anyone would want in a file you were giving away for free, let alone in a pressed Blu–Ray, so it's important to make sure that this nuisance is eliminated before you author any discs.
Testing your files:
Okay, we have a *.264 file and a *.wav file. If you don't already have tsMuxer, go ahead and download that from the "Tools" section of VideoHelp as well. Drag the *.264 and *.wav file into tsMuxer, select "*.mt2s Stream" for your output, and make sure "BDMV Compatible" is check off. (I believe it's under the General tab, it should be checked by default.) Click on the button that says something like "Start Muxing." You should now have a Blu–Ray compliant *.m2ts file that you can test in VLC or similar software before you go ahead and author a full disc with whatever you normally use. (Out of curiosity, what are you using to author Blu–Ray discs on the Mac? The options are pretty limited, so I'm definitely interested in knowing what's out there.) It's also how I discovered the need for the step above involving Audacity.
Finally, if you're working with 1080p23.976/1080p24 footage, the following variant of the command above can be used:
Code:./ffmpeg -i INPUT.mov -c:v h264 -preset veryslow -b:v 20000k -maxrate 40000k -bufsize 30000k -level 4.1 -pix_fmt yuv420p -x264-params bluray-compat=1:open-gop=1:slices=4:keyint=24:colorprim=bt709:transfer=bt709:colormatrix=bt709:pass=1 OUTPUT.264
Code:./ffmpeg -i INPUT.mov -c:v h264 -preset veryslow -b:v 20000k -maxrate 40000k -bufsize 30000k -level 4.1 -pix_fmt yuv420p -x264-params bluray-compat=1:open-gop=1:slices=4:keyint=25:fake-interlaced=1:colorprim=bt709:transfer=bt709:colormatrix=bt709:pass=1 OUTPUT.264
Specs: Mac Mini (Early 2006): 1.66 GHz Intel Core Duo CPU, 320GB HDD, 2GB DDR2 RAM, Intel GMA 950 integrated graphics card, Matshita UJ-846 Superdrive, Mac OS X 10.5.7 and various peripherals. System runs Final Cut Express 3.5 for editing. -
Specs: Mac Mini (Early 2006): 1.66 GHz Intel Core Duo CPU, 320GB HDD, 2GB DDR2 RAM, Intel GMA 950 integrated graphics card, Matshita UJ-846 Superdrive, Mac OS X 10.5.7 and various peripherals. System runs Final Cut Express 3.5 for editing.
-
x264 has blu-ray compatibility options -- though I can't vouch for how well they work. One can easily demux h.264 elementary streams from mp4 files.
-
x264's Blu–Ray compatibility options work; they're used by Criterion (via FFMpeg) on a regular basis and have been used on other major commercial Blu–Ray releases as well. (e.g. Friends Season One, per x264's own website.) However, those compatibility options need to be enabled when the stream is initially created or you'll have nothing but problems with it; at best you'll wind up with "friendly" authoring software that decides to re–encode your files for you, creating quality loss in the process, which is something a person authoring discs for the purpose of pressing is going to actively want to avoid. This is why FFMpeg or one of its variants, with or without a front–end like ff–works is a must; not Handbrake or AVIDemux. While both Handbrake and AVIDemux use portions of x264, they do not author Blu–Ray compliant files, or even Blu–Ray compliant streams. At best you would wind up with elementary streams that would need to be re–encoded, which is unacceptable in a professional production environment, and completely avoidable using the method I've outlined above.
Specs: Mac Mini (Early 2006): 1.66 GHz Intel Core Duo CPU, 320GB HDD, 2GB DDR2 RAM, Intel GMA 950 integrated graphics card, Matshita UJ-846 Superdrive, Mac OS X 10.5.7 and various peripherals. System runs Final Cut Express 3.5 for editing. -
Thanks so much. I've copied ffmpeg to the same project folder as my video file on an external Drobo drive, but I'm having problems specifying the paths in Terminal.
External Drobo Drive/Current Project/ProjectA/ffmpeg
External Drobo Drive/Current Project/ProjectA/Project.mov
Terminal says: ./ffmpeg: No such file or directory
Edit - OK, I left the first dot off the path to ffmpeg and it now seems to be encoding. Will report back. Thanks -
I agree that using ffmpeg is a better option because you have better control. But I'm pretty sure AviDemux lets you specify all the Blu-ray compatibility options via it's GUI. And Handbrake lets you manually add any x264 options you want in the "Extra Options" box. Like I said, I'm not sure how well they work in practice -- for example, maybe some of the Handbrake GUI options will conflict with, or override, the manual options.
In any case, the user seems to finally have ffmpeg working.Last edited by jagabo; 24th Mar 2021 at 09:54.
-
Hi jagabo, I've had a play around with AviDemux, and on first glance it appears pretty good. However, I'm unsure how to export encoded files with the correct file type extension. Can you help?
For example, Apple's Compressor exports Blu-ray encoded files with a .264 extension.
Also with AviDemux, I'm not quite sure what controls it has for the varying types of film grain. -
I've now done my first test encode, and I'm seeing this error, any suggestions?
ProRes422HQMovie.mov: corrupt decoded frame in stream 2. 251x
ProRes422HQMovie.mov: corrupt decoded frame in stream 2. 252x
the rest:
frame=131327 fps=6.1 q=-1.0 Lsize=13383358kB time=01:31:11.87 bitrate=20036.4kbits/s speed=0.254x
video:13383358kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
[libx264 @ 0x7fb1ef019a00] frame I:4564 Avg QP:23.37 size:205910
[libx264 @ 0x7fb1ef019a00] frame P:42267 Avg QP:26.36 size:112620
[libx264 @ 0x7fb1ef019a00] frame B:84496 Avg QP:26.68 size: 94735
[libx264 @ 0x7fb1ef019a00] consecutive B-frames: 5.4% 1.5% 75.3% 17.9%
[libx264 @ 0x7fb1ef019a00] mb I I16..4: 0.6% 96.3% 3.1%
[libx264 @ 0x7fb1ef019a00] mb P I16..4: 0.1% 17.6% 0.1% P16..4: 40.5% 30.8% 10.2% 0.1% 0.0% skip: 0.5%
[libx264 @ 0x7fb1ef019a00] mb B I16..4: 0.0% 6.6% 0.0% B16..8: 53.4% 15.6% 4.4% direct:12.4% skip: 7.6% L0:48.7% L1:44.9% BI: 6.4%
[libx264 @ 0x7fb1ef019a00] final ratefactor: 22.37
[libx264 @ 0x7fb1ef019a00] 8x8 transform intra:98.3% inter:85.4%
[libx264 @ 0x7fb1ef019a00] direct mvs spatial:100.0% temporal:0.0%
[libx264 @ 0x7fb1ef019a00] coded y,uvDC,uvAC intra: 97.9% 61.5% 18.9% inter: 75.2% 37.6% 0.1%
[libx264 @ 0x7fb1ef019a00] i16 v,h,dc,p: 27% 17% 24% 32%
[libx264 @ 0x7fb1ef019a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 7% 5% 8% 11% 16% 13% 15% 11% 13%
[libx264 @ 0x7fb1ef019a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 9% 5% 2% 10% 15% 15% 15% 13% 15%
[libx264 @ 0x7fb1ef019a00] i8c dc,h,v,p: 42% 29% 17% 11%
[libx264 @ 0x7fb1ef019a00] Weighted P-Frames: Y:12.5% UV:3.2%
[libx264 @ 0x7fb1ef019a00] ref P L0: 63.7% 36.3% 0.0%
[libx264 @ 0x7fb1ef019a00] ref B L0: 80.8% 19.2%
[libx264 @ 0x7fb1ef019a00] ref B L1: 97.0% 3.0%
[libx264 @ 0x7fb1ef019a00] kb/s:20036.06 -
AviDemux cannot export as an h.264 elementary stream. You should export as MOV or MP4 then demux the video to an elementary stream. I don't know what's available on the Mac but with ffmpeg it's:
Code:ffmpeg -i input.mov -c copy output.264
-
I've been encoding for Blu-ray with ffmpeg/x264, but all the encodes state they are encoded with: x264 core 161 r3048 b86ae3c
I've just checked my installed version (via Homebrew) and it says I have x264 is x264 r3060 installed.
Does anybody know why ffmpeg is referencing an older version of x264 to perform the encodes? Is it a Mac issue?
Thanks. -
I usually use ffmpeg builds from https://evermeet.cx/ffmpeg/ on Mac OS and at least those lack any gpu acceleration for encoding.
Not sure whether vce support is even available on mac os. (I think there are no vce capable drivers for mac os,..)
Iirc there it was possible to compile ffmpeg with videotoolbox support, but no clue whether videotoolbox even exists on newer MacOSs.users currently on my ignore list: deadrats, Stears555 -
It looks like you can use -c:v h264_videotoolbox or -c:v hevc_videotoolbox.
https://stackoverflow.com/questions/52591553/how-to-use-ffmpeg-with-gpu-support-on-macos -
Shutter Encoder has a good GUI which uses ffmpeg
Extremely easy to setupLast edited by Eric-jan; 13th Nov 2022 at 08:34.
Similar Threads
-
Hybrid(Windows/Linux/Mac): Input -> x264/x265/Xvid/VP8/VP9
By Selur in forum Video ConversionReplies: 2187Last Post: 3rd Dec 2023, 12:51 -
x264 encoding problem
By umbie in forum Video ConversionReplies: 20Last Post: 18th Nov 2018, 05:32 -
x264 benchmark? what mobile chipset to do more fast encoding x264 encoding?
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 22nd Sep 2018, 00:06 -
Simple x264/x265 Launcher encode log
By leghorn in forum Newbie / General discussionsReplies: 2Last Post: 24th Mar 2017, 06:13 -
Simple x264/x265 Launcher help!!!!
By Hiacios in forum Video ConversionReplies: 7Last Post: 14th Jun 2016, 10:44