Blu-ray + UHD/4K + Streaming

A community for authoring Blu-ray, 4K/UHD and more!

Hi guys,

I'm wondering if anybody has successfully encoded .264 files with ffmpeg. Since it has x264 built-in, it should be capable of outputting Blu-ray compatible video. However, despite (I think) successfully converting all of the input parameters into ffmpeg's command line format, I'm getting compatibility problems on PS4, which leads me to believe that the resulting file isn't QUIIIITE up to spec. 

ffmpeg -I input.mov -c:v libx264 -pass 1 -b:v 30000k -tune film -level 41 -g 24 -r 24000/1001 -pix_fmt yuv420p -preset veryslow -vf setsar=sar=1/1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=31000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo /dev/null

ffmpeg -I input.mov -c:v libx264 -pass 2 -b:v 30000k -tune film -level 41 -g 24 -r 24000/1001 -pix_fmt yuv420p -preset veryslow -vf setsar=sar=1/1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=31000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo output.264

MediaInfo reports the following encoding settings:

cabac=1 / ref=6 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=24

What do you guys think? Has anyone successfully gotten this to work on ffmpeg?

UPDATE: ffmpeg is not qualified for Blu-ray, despite passing all verification tests. Major issues with PS4 playback. Do not use.

Views: 107

Reply to This

Replies to This Discussion

Why using ffmpeg when you can use x264?
Since no one has tested files created by ffmpeg in one of the known verifiers yet I don't trust ffmpeg in this task since the command line looks different and since it's still unknown what parameters give 100% reliable results! I simply miss a reference.

Andreas

There are a few good reasons that ffmpeg would be preferable. x264 is very limited in how video is input; on Windows you have to use AVIsynth and a pipe like avs4x264mod to feed the encoder, and AVIsynth is still 32-bit. AVIsynth can also introduce color problems depending on the file formats and input methods you use. Outside of Windows it's almost useless.

ffmpeg can read almost anything, and output almost anything, and it's multi-platform. Encoding is easily done on a Mac or Linux box in addition to Windows, and since it's multi-threaded and 64-bit all the way through, it's much faster doing the same encode task. Combined with bash shell scripting, it's quite possible to build a quick double-clickable applet that batch encodes any combination of .264, .wav, .ac3, and other deliverables you might need. You can even add resolution and frame rate sensing with MediaInfo to set the settings correctly. Someone could even conceivably build a custom GUI to do all of this.

So, yeah... I really want to get this working. :D

Great news! With a little work, I've managed to figure out the command line for HD video streams!

Rob has been nice enough to run these through verifiers on his end, and we came out clean. This means that Windows users can encode with these settings at speeds up to twice as fast as x264 + AVIsynth, and Mac and Linux users can encode just as well, straight from ProRes, DNxHD, or whatever else you can think of! 

For 1080p/23.98 video, use the following command lines:

ffmpeg -i "filename" -c:v libx264 -pass 1 -b:v 30000k -tune film -level 41 -g 24 -r 24000/1001 -pix_fmt yuv420p -preset veryslow -vf setsar=sar=1/1 -refs 4 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo /dev/null
ffmpeg -i "filename" -c:v libx264 -pass 2 -b:v 30000k -tune film -level 41 -g 24 -r 24000/1001 -pix_fmt yuv420p -preset veryslow -vf setsar=sar=1/1 -refs 4 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo "filename.264"

For 1080i/29.97, use the following:

ffmpeg -I input.file -c:v libx264 -pass 1 -b:v XXXXX -tune film -level 41 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -preset veryslow -filter_complex scale=interl=1,setsar=sar=1/1,fieldorder=tff -refs 4 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo /dev/null
ffmpeg -I input.file -c:v libx264 -pass 2 -b:v XXXXX -tune film -level 41 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -preset veryslow -filter_complex scale=interl=1,setsar=sar=1/1,fieldorder=tff -refs 4 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo output.264

Sounds good! Is it possible anyhow to define a similar parameter to set "fakeinterlaced" for progressive content? How do you define chapter points? Is it possible to define a timecode list?

Andreas,

fakeinterlaced appears to work, but we're still testing for verification on those. I'll update in a week or so. However, it looks like ffmpeg doesn't pass -pulldown settings properly, so 480p/24 is out. I'm trying to figure out a way by combining ffmpeg with x264.

Still researching the chapter points. Low priority for me, TBH.

480i/29.97 is now verified also... (Below is for 16x9 video, if you need 4x3 change sar=40/33 to sar=10/11, and also field order if necessary)

ffmpeg -I input.file -c:v libx264 -pass 1 -b:v XXXXX -tune film -level 41 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -preset veryslow -filter_complex scale=interl=1,fieldorder=tff,setsar=sar=40/33 -refs 6 -color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo /dev/null
ffmpeg -I input.file -c:v libx264 -pass 2 -b:v XXXXX -tune film -level 41 -g 30 -r 30000/1001 -flags +ilme+ildct -pix_fmt yuv420p -preset veryslow -filter_complex scale=interl=1,fieldorder=tff,setsar=sar=40/33 -refs 6 -color_primaries smpte170m -color_trc smpte170m -colorspace smpte170m -x264opts bluray-compat=1:vbv-bufsize=30000:vbv-maxrate=40000:slices=4:open-gop=1:force-cfr=1 -y -f rawvideo output.264"

Thanks.
BTW, I let AVISynth do the reverse telecine process which works very well.

Yes, I agree, if you're using AVIsynth for IVTC, there's no point to using ffmpeg.

Andreas, it looks like defining chapter points is not possible under ffmpeg. You'll have to do without, I'm afraid (though to be honest, I never bother with this even with x264).

Thank you very much!
I always encode chapter points as I-frames. It's more reliable to jump to right chapter point.

Update: Our first disc with this encoder, despite passing all verification tests, had some major stuttering issues on PS4. Don't use this. Back to the drawing board.

Hi all,

I'm using ffmpeg with x264 since a long time for BD authoring without any known issue.

I use the pipe function for that.

For a 24 fps video:

ffmpeg -i VideoIn.mov -f rawvideo -pix_fmt yuv420p - | x264 --demuxer raw  --bitrate 35000 --preset veryslow --tune film --bluray-compat --vbv-maxrate 38000 --vbv-bufsize 30000 --level 4.1 --keyint 24 --open-gop --fps 24 --force-cfr --slices 4 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 --input-res 1920x1080 -o VideoOut.264 -

You can input any video ffmpeg accepts and then encode directly with x264. Don't forget to resize your video to 1920x1080 if needed with -s 1920x1080.

You can find the x264 options here: http://www.x264bluray.com/

Let me know if it works with PS4.

Lilian

Reply to Discussion

RSS

Latest Activity

lilian replied to Justin Sevakis's discussion Encoding with ffmpeg
"For 29.97i to 23.976p with ffmpeg: -vf "fieldmatch=order=auto:combmatch=none,…"
Oct 6
lilian replied to Justin Sevakis's discussion Encoding with ffmpeg
"-vf "fieldmatch=order=auto:combmatch=none, decimate" or -vf…"
Oct 6
lilian replied to Justin Sevakis's discussion Encoding with ffmpeg
"Hi all, I'm using ffmpeg with x264 since a long time for BD authoring without any known…"
Oct 6
Henry Weintraub replied to Henry Weintraub's discussion Managed Copy Information error
"Thanks for the input. I may just try re-installing the OS and see if that helps."
Oct 2

© 2018   Created by Denny and Rob.   Powered by

Badges  |  Report an Issue  |  Terms of Service