PDA

View Full Version : Problem with x264 encoding


martino
6th November 2006, 18:00
Hi,

I did an encoding of a 30 second clip(no audio, xVid compression) using x264(to H264) through MeGUI. The output video however doesn't match the input. If you scroll to a certain frame on both of them(eg 24s), the images are different. Also, in the output video there is a gray bit of video, which isn't in the input.

Here (http://rapidshare.com/files/2240121/video.rar.html) are both of the video files, where the MP4 file is the output.

Avisynth script:
DirectShowSource("Z:\1_30sec.avi",fps=23.9759856527702,audio=false)
ConvertToYV12()

MeGUI log:
Starting job job1-1 at 16:48:19
encoder commandline:
--pass 1 --bitrate 500 --stats "Z:\1_30sec.stats" --bframes 3 --b-pyramid --direct auto --filter 1,1 --subme 1 --analyse none --vbv-maxrate 25000 --me dia --thread-input --progress --no-psnr --output NUL "Z:\1_30sec.avs"
successfully started encoding
Processing ended at 16:48:56
----------------------------------------------------------------------------------------------------------

Log for job job1-1

avis [info]: 640x480 @ 23.98 fps (720 frames)
x264 [warning]: VBV maxrate specified, but no bufsize.
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
x264 [info]: slice I:8 Avg QP:22.25 size: 25649
x264 [info]: slice P:250 Avg QP:26.00 size: 4970
x264 [info]: slice B:462 Avg QP:25.22 size: 708
x264 [info]: mb I I16..4: 59.1% 0.0% 40.9%
x264 [info]: mb P I16..4: 10.4% 0.0% 0.0% P16..4: 29.9% 0.0% 0.0% 0.0% 0.0% skip:59.8%
x264 [info]: mb B I16..4: 0.4% 0.0% 0.0% B16..8: 4.5% 0.0% 0.0% direct: 5.2% skip:89.9%
x264 [info]: direct mvs spatial:99.4% temporal:0.6%
x264 [info]: SSIM Mean Y:0.9724084
x264 [info]: kb/s:472.8

encoded 720 frames, 20.33 fps, 473.10 kb/s

----------------------------------------------------------------------------------------------------------
Job completed successfully and deletion of intermediate files is activated
job job1-1 has been processed. This job is linked to the next job: job1-2
Starting job job1-2 at 16:48:56
encoder commandline:
--pass 2 --bitrate 500 --stats "Z:\1_30sec.stats" --ref 16 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --direct auto --filter 1,1 --subme 7 --trellis 2 --analyse all --8x8dct --vbv-maxrate 25000 --me umh --thread-input --progress --no-psnr --output "Z:\1_30sec.mp4" "Z:\1_30sec.avs"
successfully started encoding
Processing ended at 16:54:12
----------------------------------------------------------------------------------------------------------

Log for job job1-2

avis [info]: 640x480 @ 23.98 fps (720 frames)
x264 [warning]: VBV maxrate specified, but no bufsize.
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
mp4 [info]: initial delay 208542 (scale 2500000)
x264 [info]: slice I:8 Avg QP:19.00 size: 22779
x264 [info]: slice P:250 Avg QP:21.49 size: 5675
x264 [info]: slice B:462 Avg QP:22.25 size: 694
x264 [info]: mb I I16..4: 44.6% 33.9% 21.4%
x264 [info]: mb P I16..4: 2.7% 2.7% 1.7% P16..4: 36.9% 6.5% 3.8% 0.3% 0.2% skip:45.1%
x264 [info]: mb B I16..4: 0.1% 0.1% 0.0% B16..8: 15.1% 0.3% 0.7% direct: 0.8% skip:82.9%
x264 [info]: 8x8 transform intra:37.1% inter:60.7%
x264 [info]: direct mvs spatial:88.5% temporal:11.5%
x264 [info]: ref P 53.8% 13.4% 11.4% 2.9% 3.0% 2.2% 3.5% 1.2% 1.0% 1.4% 3.2% 1.2% 0.6% 0.4% 0.6% 0.2%
x264 [info]: ref B 82.3% 10.7% 4.5% 1.0% 0.5% 0.3% 0.2% 0.1% 0.1% 0.1% 0.0% 0.1% 0.0% 0.0% 0.0%
x264 [info]: SSIM Mean Y:0.9876324
x264 [info]: kb/s:511.9

encoded 720 frames, 2.29 fps, 512.20 kb/s

desired video bitrate of this job: 500 kbit/s - obtained video bitrate (approximate): 514 kbit/s
----------------------------------------------------------------------------------------------------------
Job completed successfully and deletion of intermediate files is activated
Found intermediate output file 'Z:\1_30sec.stats', deleting...
Deletion succeeded.
It does the same thing no matter how many passes I choose, however I haven't tried quantitazer yet.


Thanks


P.S. On a side note, if I want to encode an MKV file with x264 through MeGUI, which has ASS/SSA subs in the file, what do I need to un/check to make sure that the subs will not be written onto the output video?

DarkZell666
6th November 2006, 19:32
The grey frames looks like you installed AviSynth version 2.5.7 RC1. In the avisynth development thread they talk about this. Try with Avisynth 2.5.6 and tell us what changes.

martino
6th November 2006, 20:08
I have Avisynth 2.5.6 installed...

bob0r
6th November 2006, 20:20
Grey frames reason:
DirectShowSource("Z:\1_30sec.avi",fps=23.9759856527702,audio=false)

DirectShowSource = bad mmmkay

DarkZell666
6th November 2006, 21:06
I reproduced the problem, and got I rid of it using avisource indeed :p

But, hell, i've never had the problem with directshowsource before ... oO (I've just tried both Avisynth versions ... 2.5.6a and 2.5.7 RC1). What on earth is this ?

This has gotta be moved to the avisynth forum too don't you think ? ;)

martino
6th November 2006, 21:29
Grey frames reason:
DirectShowSource("Z:\1_30sec.avi",fps=23.9759856527702,audio=false)

DirectShowSource = bad mmmkay
What do you mean. I'm not a computer newbie, but I ventured into Avisynth, x264 and MeGUI only a few days ago so please take that into account.

Is this some kind of a bug, or is it just me that messed up something with the Avisynth script?

Thanks for the input.

foxyshadis
7th November 2006, 01:13
DSS reads lots of formats, but DirectShow is already a mess to support, and avisynth's implementation isn't perfect. (Better in 2.5.7 than 2.5.6 though.) It has to crowbar Directshow into VFW; even if those don't mean anything to you, it's simply a hard problem because of the way some DS filters works. Avisource is much preferred over DSS for avis, but MeGUI won't use it by default.

martino
7th November 2006, 08:32
So you are saying that I should try "Avisource" instead of "DirectShowSource", right?

I'll give it a try...

UPDATE: No luck. Now there is a green frame at the very start, and one section of the video repeats twice. I haven't done any more detailed observation since I have to go to school. I'll upload the output and logs as soon as I'll come back home.

foxyshadis
7th November 2006, 10:14
Try using Mpeg4Modifier to pack the stream. The green frame problem is caused by unpacked streams. Not sure about the repeating part though.

martino
7th November 2006, 18:39
I did try Mpeg4Modifier, but the result is exactly the same. And while I was in school I left my PC to do another encode, and the frames are different there as well! Not by such a big margin, but it's enough to cause a problem. What the hell is going on?!?!

http://rapidshare.com/files/2379714/1_30sec_2.rar.html
-that's the encode when using "Avisource..."

martino
7th November 2006, 23:41
YES! I installed the latest RC1 Avisynth and just from a quick look it seems to have worked fine. I'll do some more checking tomorrow.

martino
8th November 2006, 18:08
Sorry for the triple post, but it's better to get someone's attention.

The short clip which I've been trying to encode matches it's source exactly. However overnight I run another encode, and now this one doesn't match. The input was an MKV container with xVid video, and softsubs(which were hardwritten to the output; once again, how can I turn this off?). I'm lost here...

DarkZell666
9th November 2006, 10:17
In the AviSynth development thread, I remember something being said about the audio and video fetching not being synchronous. This would explain why "sometimes it works, sometimes it doesn't".

I wouldn't be able to tell you more about that, but this grey frames stuff is new to me, I've never had the problem.

foxyshadis
9th November 2006, 11:51
To prevent subtitles from merging into the video, turn off all sub display (in vsfilter, usually). DSS will use exactly what you see when playing the video, after all filtering and processing between the decoder and player are done. I always have a ffdshow profile to turn off all processing when opening in avisynth.

martino
9th November 2006, 18:08
In the AviSynth development thread, I remember something being said about the audio and video fetching not being synchronous. This would explain why "sometimes it works, sometimes it doesn't".

I wouldn't be able to tell you more about that, but this grey frames stuff is new to me, I've never had the problem.
Ok, I'll go and take a look there. I mean the difference isn't that big now, but it's enough to put me off from encoding all my xvid stuff to h264...

To prevent subtitles from merging into the video, turn off all sub display (in vsfilter, usually). DSS will use exactly what you see when playing the video, after all filtering and processing between the decoder and player are done. I always have a ffdshow profile to turn off all processing when opening in avisynth.
I did and it was still loaded during the encoding process and the subs were hardwritten to the video. I know that I could extract the video from the MKV and do it that way, but I want to be able do it in straight way. Isn't there some kind of command for the avisynth script that would disable subs?

foxyshadis
9th November 2006, 22:12
You can use graphedit, and save its .grf files to load into DSS. That way you can delete vsfilter or whatever might be getting into the graph wrongly. You need to remove the renderer, also.

martino
9th November 2006, 23:14
Woah! That looks so cool! I'll have to play around with that for sure. Thanks for the input!

UPDATE: After some more examination, the video that appeared to be fine actually wasn't. It was off by something like 1 or 2 frames... *hits his head against a wall*

Jay Bee
13th November 2006, 01:02
You can use graphedit, and save its .grf files to load into DSS.

Wow, that's a great hint. Didn't know that, very usefull.