How to render for blu-ray

Hello all,

This is my first post, and first video edited in kdenlive, so go easy lads. lol :D

Anyways, some background... I shot some HD video for a friend's wedding and am putting together something nice for them (wanted to get it done for Christmas, but apparently had to learn a hard lesson in appropriate intermediate formats first, hee hee). It was shot on a Canon HF-S100 at 1080 60i MXP. Transcoded to DNxHD 220 with

ffmpeg -i infile.MTS -vcodec dnxhd -b 220M -r ntsc -flags +ilme+ildct -threads 4 -mbd rd -acodec pcm_s16le outfile.mov

Started off using a 1080p 30fps project, but after the intermediate format fiasco I also learned that the blu-ray spec doesn't support 30p so I went to a 1080i 29.97fps project (which I read is the same as 60i, 59.94 fields per second, 29.97 frames per second). I'm trying to keep it as close to original quality as possible, and I will be burning it to a BD-R disc.

Right, so that's where I'm coming from. I'm just about finished editing and ready to render and realized I'm not really sure how best to render for blu-ray. There's no blu-ray render profile so I'll have to come up with something. Thought about starting from one of the h.264 profiles, then saw the render profile in the contrib section on here, but it's not approved so cannot view it. I sent the author a message asking to see the parameters. Looks like he's using an mts container, ac3 audio, and I'm assuming h.264 video... or maybe mpegts only supports mpeg2, I'm far from an expert on this stuff.

I'm leaning towards h.264 for the video and ac3 for the audio, but want to make sure I don't screw up some small detail or miss an important parameter. Running a test right now using an altered version of the H.264 25000k profile where I have changed the following f=mpegts acodec=ac3 ab=448k, everything else was left as-is.

Am I on the right track here, or way off base? Any suggestions from the folks "in-the-know" ?

Thanks! :)

~ Nick

EDIT: I should point out that I'm planning on copying the rendered file onto my windows box and using multiAVCHD to create some sexy menu hotness, so I'm wondering if there's a render format that will prevent any need to re-render from that software... I'm hoping anything defined by the blu-ray spec simply copies the file into the menu structure.

Forums:

I just approved the Blu-ray render profile so you can try it out.

Okay, well that profile doesn't work for me for whatever reason. multiAVCHD will add it okay, but upon processing it crashes (log seems to suggest tsMuxer has some problem with the audio track). No big deal, it took over 2 hours to process 45 seconds worth of video anyway, so that's not really feasible for me.

On a positive note, the altered H.264 profile works if I render to mp4. The only problem being, once I get it onto the disk, it plays fine for a few seconds and then starts to get sluggish, like it's playing in slow motion. If I pause it for a few seconds and resume playing, it'll again play fine for a few seconds and then slow down again.

I thought maybe the bitrate was too high, but lowering the bitrate doesn't seem to resolve the issue at all, so not really sure what to add/remove/change at this point... maybe something to do with frames, I don't know. Any suggestions/ideas?

EDIT: Just found this posting (http://forum.doom9.org/showthread.php?t=154533) on doom9 that looks helpful, but don't know how to convert these parameters to a kdenlive profile... came up with this by sort of cross referencing the blu-ray profile on here with that post

f=mp4 hq=1 acodec=aac ab=448k ar=48000 pix_fmt=yuv420p vcodec=libx264 minrate=0 b=15000k b_strategy=2 level=41 bf=3 ref=4 keyint=60 bufsize=15000 vbv-maxrate=15000 subcmp=2 cmp=2 coder=1 flags=+loop flags2=+dct8x8+aud+bpyramid nal-hrd slices=4 open-gop=bluray qmax=51 subq=7 qmin=10 qcomp=0.6 qdiff=4 trellis=2 aspect=%dar pass=2

but I must've messed something up since the output wasn't valid... is there a rendering log somewhere?

I suppose if I can't figure it out I could just render it to whatever and then run that file through ffmpeg again directly to set this stuff, but I'd like to avoid that if possible.

Okay, well, I figured out a few things tonight.

1) It doesn't have anything to do with the intermediate transcode. Imported original MTS to kdenlive and rendered, same effect seen.

2) It doesn't have anything to do with the audio codec. Rendered without audio, same effect.

3) It doesn't have anything to do with the media. Tried opening from USB, tried burning to DVD-R, and BD-R, all the same.

4) If I go all the way down to 1000k bitrate (H.264 profile), it seems to play smoothly, although I only tested with a 10 second clip.

Now, 1000k is WAY too low unless there's something seriously wrong with my player (LG BD390 with latest firmware), but I suppose that is a possibility although I haven't found anything mentioning such an issue with this particular player. Plus the rendered files have issues playing on the computer as well, which leads me to believe there's something wrong with the file itself, but I might try it on another player for the hell of it if I can find one to use.

I think tomorrow I'm going to try skipping kdenlive altogether and just go straight through ffmpeg and see if the issues are still there.

Well, Dan's opinion would be welcome, but from what I understood of the avformat consumer, the "nal-hrd" option from your parameter command should instead be "nal-hrd=1"

Not sure it helps but just in case...

Well, I think I may have found the issue, but haven't yet figured out how to fix it or even why it's happening.

So, I decided to do some quick math, 10 second video @ 25Mbps = 250 Mbits / 8 bits in a byte = an estimated file size of ~ 30 to 35 MB... but the file sizes I was getting were about 4 times that. I looked around the net and found that mediainfo could tell me more. Installed that and lo and behold, bitrates were coming out at roughly 106-107 Mbps when profile is telling it to use 25. When I run it through ffmpeg directly, I still get these crazy bitrates regardless of what I set as a maxrate or threshold, so I think it's an issue with ffmpeg or libx264 as it appears to be completely disregarding the bitrate parameter.

I might try installing the latest versions of ffmpeg / libx264 and see what happens.

...

UPDATE: Latest versions of ffmpeg, libx264, melt & kdenlive... same effing thing, so I've uploaded an original short clip to rapidshare here (http://rapidshare.com/files/440692220/00000.MTS) and I'm hoping someone can try it out and see if they have the same problem and maybe have an idea of what might be going on here... please & thank you :)

...

UPDATE 2: Well, after much pulling out of the hair, I stumbled across this exchange (http://forums.creativecow.net/thread/291/57#57). Played with the qmin parameter until I found something that seems to work. Still don't understand why it ignores the bitrate, but like I said, I think I can make this work. I played with a few other settings dealing with interlacing since I'm trying to keep it at 60i, found that adding +ildct+ilme gives it the jitters, though changing the Scanning setting to Force Interlaced produces acceptable results and multiAVCHD imports it as Interlaced TFF (top field first) which is correct. Anyways, here's what I think is my final render profile which I may add to the contribute section if I get some time tomorrow. I've tried to make it adhere to the Blu-ray spec as closely as I can according to the documentation I've found and parameters I could figure out... so without further ado:

Blu-ray 1080i60 render profile-

f=mp4 hq=1 acodec=ac3 ab=448k ar=48000 pix_fmt=yuv420p vcodec=libx264 b=25000k level=41 minrate=0 maxrate=30000k bufsize=30000k coder=1 flags=+loop cmp=+chroma partitions=+parti8x8+parti4x4+partp8x8+partb8x8 me_method=umh subq=8 me_range=16 g=30 keyint_min=1 sc_threshold=40 i_qfactor=0.71 b_strategy=2 qcomp=0.6 qmin=19 qmax=51 qdiff=4 bf=3 refs=4 directpred=3 trellis=1 flags2=+wpred+mixed_refs+dct8x8+fastpskip+aud mbd=rd wpredp=2 nal-hrd=1 sar=1:1 aspect=%dar threads=0 pass=2

Good stuff. Thanks for sharing.

This looks like a useful resource as well: http://sites.google.com/site/x264bluray/home/1080i

I wish I could find more information about the "--bluray-compat" option.

I'm going back to windows, but Kdenlive records as recorded in HD Blu-Ray?? The DVD creator of Kdenlive, K3B, Brasero, and other DVDStyler not write to Blu-ray!

Kdenlive records in HD, but how do I burn a Blu-Ray? The DVD creator of Kdenlive does not DVDstyer and also not, K3B does not also ...

marhen, you're trolling again, it was requested you stop last time. You're also digging up a one year old thread and have nothing constructive to say again. Your account is temporarily locked. PM me if you have a problem with this.

Pages