encoding problem - ipod high rez

Discuss encoding for devices and presets.
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

encoding problem - ipod high rez

Post by cmbmovies »

Hi, love the new handbrake but i've noticed that on shot changes it sometimes blocks up for a frame or too.
ie.. long shot of guy stood there (fine)
cut to close up and the first frame or two of that shot is blocky.

All i'm doing is hitting the ipod high rez setting and encoding.

Any ideas what's happening?
ToxycM
Posts: 8
Joined: Fri Sep 07, 2007 9:11 pm

Post by ToxycM »

I believe this is related to key frame intervals. If yu look on the advanced tab in the text box at the bottom you will see a string like this - keyint=300:keyint-min=30. which tells the encoder how often to put in a key frame. if you reduce the keyint number the blocky scene changes go away. I like to set mine in multiples of the frame rate of the video and a key frame every second. For progressive material I use keyint=24:keyint-min=24 and for ntsc video I use keyint=30:keyint-min=30. These settings work very well for me with 64% constant quality encodes. I am in no way an authority on this stuff so everybody feel free to correct me if I'm way off base.

Hope it helps
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

Hey, thanks for that. it was a pal dvd i was trying to encode so that would be the problem. I'll set it for 250/ 25 and see what that turns out like.
Cheers,
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

Hi there, just to let you know that didn't help me.

i'm really not sure why its happening? if i re-encode the same dvd a second time it still block up but on different scene changes so seems almost random. Have gone back to handbrake 82b for now, that works fine. just slower :(
ToxycM
Posts: 8
Joined: Fri Sep 07, 2007 9:11 pm

Post by ToxycM »

Ya I noticed that it doesn't always work. Changing the keyframe intervals made it go away on a rip of the Davinci code but I've noticed that it doesn't always do the job. I'm beginning to suspect that the encoder is the one at fault here not Handbrake. I did some experimenting with the scenecut parameter and this also seems to have some effect on the blocky scene changes. I read in another forum about a bug in specific build of x264 that was causing scene change detection to not function properly when threading is being used. I'm assuming that the use of threading is what sped up handbrake so much for this release so maybe there's a connection there.

What it boils down to is that I'm not sure how to fix it but I'm 99% sure that keyframes not being inserted at scene changes is the cause of this problem.

By the way, what model of mac are you using? I'm seeing this problem with a 2.66 Mac Pro. Maybe the number of cores used by the encoder has some effect on this? The blockiness that I'm seeing at scene changes is pretty severe. I can't imagine that this forum wouldn't be full of posts like this if everyone is getting the same results that I am.
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

Hi there.. yeh it feels like a bug in the encoder but there must be some freaky circumstances to meet for it to show itself cos its just you and me talking about it. I have a 2ghx core2duo macbook (black) so maybe the threading is the issue? allthough i've encoded some dvds and its been fine? im working mostly with pal.

Right now i've gone back to 82b which is probably technically less quality but at least i know things wont block up - its awful when it happens and makes me want to cry :)
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

ToxycM wrote:I read in another forum about a bug in specific build of x264 that was causing scene change detection to not function properly when threading is being used. I'm assuming that the use of threading is what sped up handbrake so much for this release so maybe there's a connection there.
Nope, HandBrake uses a version of x264 from after that bug was fixed.
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

hmm, weird.. any idea what's casuing it jbrjake? or do we just have freaksih systems?
ToxycM
Posts: 8
Joined: Fri Sep 07, 2007 9:11 pm

Post by ToxycM »

I saw that in the x264 changelog. The bug was fixed at r623 or so but I've done some more testing and the problem is related to threading. I compiled from svn with the thread count hard coded to 2 instead of cpu_count * 3/2 and the problem goes away. The original formula would yield a thread count of 6 for my mac pro so I'll keep bumping up from 2 until the problem reappears and post here again with the results.
ToxycM
Posts: 8
Joined: Fri Sep 07, 2007 9:11 pm

Post by ToxycM »

LOL I feel kinda silly now. Here I am recompiling and all I had to do was add :threads=2 (or whatever count you want) to the advanced string to get the same results
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

Cool, you fixed it?
So bearing in mind i'ma coding retard :) Can you tell me what to put in the advance string to fix encoding on my core2duo macbook?

i'm guessing i stick 'threads=2' somewhere?
ToxycM
Posts: 8
Joined: Fri Sep 07, 2007 9:11 pm

Post by ToxycM »

just add ':threads=2' (be sure to include the colon) to the end of the text in the text box on the advanced tab. If that doesn't fix it then try :threads=1. You'll know when you get it right because the encoding will slow down considerably.
I'm interested to know if it fixes the problem on your machine too. I encoded a 2.5 hour movie last night and couldn't find even one bad scene change. it almost doubles the encode time but it does clear up the problem.

They may have fixed a threading bug in x264 but it seems like there is still something wrong with it
rudiger10
Posts: 3
Joined: Mon Sep 10, 2007 9:49 pm

Post by rudiger10 »

ToxycM you are greatness. i was so disapointed because i had heard so much about the great handbrake, but was wondering y my videos game out so [Censored]. i believe you have solved my problem, as the video is taking long to encode. i'll let you know wen i'm done
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

Hi there, you were right. I did three test encodes on a chapter at the end of the 8mile dvd., one on the ipod high preset, one with x2 threads and one with x1 threads.

The preset one was very blocky for 2 frames on a couple of scene changes.

The x2 thread was less block but it was still there.

The x1 thread was perfect :)
ToxycM
Posts: 8
Joined: Fri Sep 07, 2007 9:11 pm

Post by ToxycM »

Glad I could help. Wouldn't want something silly to mess up such a great piece of software. The fact that cmbmovies had to go down to 1 thread is kind of interesting to me though. On my mac pro 2 threads comes out perfectly. I wonder if it's coincidence that the number of threads needed to be <= the the number of physical CPUs in the machines. Of course, it would take quite a few more test cases to know for sure, but it might be related. In any case it appears to be an x264 problem and not specific to handbrake so I'll see if I can figure out how to let that development crew know about it too.
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

Hi, i haven't thought about this issue for a long time. I upgraded to the new handbrake round about the time leopard came out and have only recently started to encode movies again.

I was on a train yesterday watching hairspray on my iPhone and i notice this issue is back - or perhaps it never went away and i just assumed the updated handbrake version fixed it? Oddly, it doesnt do it on anything i have to de-interlace, ie music videos and tv sourced stuff. But if i rip a movie from dvd it seems to happen without fail. I presume switching to one thread encoding will fix things again. I'll try it when i get home tonight and let you know.

Did the new handbrake fix things for anyone else?
cmbmovies
Posts: 14
Joined: Mon Aug 27, 2007 8:22 am

Post by cmbmovies »

I did some tests last night and found the amount of 'blockage' on scene changes various depending on the amount of cropping applied. So ripping chapter 1 of 'Hairspray' 3 times I found that:

iPood High Preset, auto cropping:
Blockage on first frame or two after a scene change

iPod High Preset, no cropping:
much better. I thought there was none at all until i compared it too...

iPod High Preset modified to encode with 1xThread with any cropping:
Peferct, with a cleaner and sharper encode on every scene change. I found with the others even when it was good it took a few frames for digital noise to kinda 'sette down'. With this setting there was no settling down period.

So, i don't know why this happens but its 1x Thread encoding for me... and long waits it seems.
Post Reply