Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th January 2013, 13:55   #1  |  Link
suckerpuncher
Registered User
 
Join Date: Jun 2005
Posts: 11
x264 and PES Errors

I use Staxrip and the x264 codec to encode HD ts-files I recorded with my VU+ Duo, mainly sports events like the bowl games.
Before I encode them I use TS-Doctor to cut out commercials. Due to the length of the records (about 3.5-4 hours gross) and my less then perfect dish setting there are PES errors (SizeMismatch) from time to time. Normally about 1-3 per recording.

Until recently I never had any problems. But now after upgrading my hardware I do. Unfortunately I couldn't save my old StaxRip settings due to a hdd crash so I recreated them as good as I could and by looking at the MediaInfo of my old work. Pretty much standard settings. Level 4.1, preset fast and crf 20.
And as filters I only use Source, Field (Deinterlace) and Resize (LanczosResize). The same I used before.

But now I run into problems. Or better the x264 encoding does.
When it hits the PES Error (sometimes it works fine after the first PES Error but certainly runs into problems after hitting the second) the encoding speed drops to about 1fps from 20fps I had before. The CPU usage also drops to no more than 50%.
I tried several ts-files, several versions of Staxrip and also several versions of the x264 codec but no luck.
Everytime it gets to the PES Error the encoding speed drops to about 1fps.

Did I miss any option? Is there a way to avoid the encoding speed to drop that drastically when it hits the PES error? As you can probably guess I'm not an expert when it comes to the whole codec settings.

I mean it worked on my old hardware without any problems but for some reason now it doesn't work correctly anymore.

Thanks in advance.

Last edited by suckerpuncher; 13th January 2013 at 14:11.
suckerpuncher is offline   Reply With Quote
Old 13th January 2013, 16:58   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
The problem should not have anything to do with x264 but is likely a problem of the source filter. Which source filter are you using?
sneaker_ger is offline   Reply With Quote
Old 13th January 2013, 17:18   #3  |  Link
suckerpuncher
Registered User
 
Join Date: Jun 2005
Posts: 11
Source Filter is set to Automatic and normally DirectShow is used. That was also the case before and it didn't create any problem then.

Here's the complete entry from the avs used:
LoadCPlugin("C:\Program Files (x86)\tv toolz\StaxRip_1.1.8.0\Applications\AviSynth plugins\Yadif\yadif.dll")
DirectShowSource("F:\TEMP\test.ts", audio=false, convertfps=true, fps=25)
Crop(0,0, -Width % 8,-Height % 8)
ConvertToYV12()
Yadif()
LanczosResize(1280,720)

And this is how the x264 codec is used:
"C:\Program Files (x86)\tv toolz\StaxRip_1.1.8.0\Applications\x264\x264.exe" --preset fast --crf 20 --level 4.1 --output "F:\TEMP\test temp files\test_Output.h264" "F:\TEMP\test temp files\test.avs"


I can upload a complete StaxRip log from a 4 minute test file which took about 51 minutes to encode.
suckerpuncher is offline   Reply With Quote
Old 13th January 2013, 17:31   #4  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
The problem is that "DirectShowSource()" can mean many things, because it depends on the filters you have installed (splitter, decoder) and their versions, how they have been set-up and which merits are assigned to them. At least one of these things likely differs between your old and your new system. If you're using hardware-acceleration (CUVID, DXVA2 copy-back...) the drivers and hardware might also play a role.

If you have a suitable Nvidia card and 15 dollars to spare I suggest you try DGDecNV instead of DirectShowSource.

Your cropping seems weird, btw.

Last edited by sneaker_ger; 13th January 2013 at 17:35.
sneaker_ger is offline   Reply With Quote
Old 13th January 2013, 17:37   #5  |  Link
suckerpuncher
Registered User
 
Join Date: Jun 2005
Posts: 11
I have an ATI card.

I tried to use FFVideoSource and now the duration of the clip is shown as 8 minutes instead of 4 minutes and the number of frames is almost doubled (11991 to 6004).
The framerate now stays constant during the encoding and isn't impacted by the PES Errors yet the resulting video is almost unplayable because it stutters since it runs at about half the speed it should.

So it seems you're right with the Source filter.


I don't crop anything. The Directshow filter adds this line on its own.

Last edited by suckerpuncher; 13th January 2013 at 17:43.
suckerpuncher is offline   Reply With Quote
Old 13th January 2013, 17:57   #6  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by suckerpuncher View Post
I tried to use FFVideoSource and now the duration of the clip is shown as 8 minutes instead of 4 minutes and the number of frames is almost doubled (11991 to 6004).
FFVideoSource works very badly with TS sources. You can try to improve it a bit by trying the following measures, though:
- remux to mkv first with mkvmerge (*)
- try a combination or all of the following parameters: fpsnum=25, threads=1, seekmode=0

Quote:
Originally Posted by suckerpuncher View Post
I don't crop anything. The Directshow filter adds this line on its own.
/edit:
Oh, I forgot that % means mod in AviSynth, not divide by. Ignore what I said.

Quote:
Originally Posted by suckerpuncher View Post
I have an ATI card.
You're a bit out of luck with that. If the ffvideosource tricks don't work, try building your own graph with graphstudio or graphedit. I recommend using the LAV filters for that. Your graph should only include LAV Splitter as the splitter and LAV Video as the video decoder (and the line connecting those two). Try activating DXVA2 copy-back in LAV Video and also remuxing to mkv prior(*). Then save the graph to "something.grf" and load it like this:
DirectShowSource("something.grf", fps=25, convertfps=true, audio=false)

I forgot to ask, but this is an H.264 source, right? (25 fps and HD kinda imply it) If it is MPEG-2 you might also want to try DGMPGDec.

(*) I'm not 100% sure how mkvmerge will handle the stream errors though. It might drop the complete frame or even GOP.

Last edited by sneaker_ger; 13th January 2013 at 18:04.
sneaker_ger is offline   Reply With Quote
Old 13th January 2013, 20:06   #7  |  Link
suckerpuncher
Registered User
 
Join Date: Jun 2005
Posts: 11
Alright, I made a couple of test runs.

FFVideoSource runs through at full speed but the results stills stutters. Not as bad as before but still visible which gets annoying. No matter which parameters I use the result is the same.

I created the graph. I think I did it correctly since the encoding worked. But I added a small picture to make sure. Once again full speed all the way to the end. Yet the result is even worse. The file was just about half the size of the other results and it stutters completely. Both with the original ts-file and the converted mkv-file.

Then I accidently disabled the DeInterlace filter and guess what it worked without a problem with both the standard DirectShowSource and the new DirectShowSource via the graph. No more slowing down at the PES Errors. No more stuttering. And MediaInfo still shows the result as progressive.
Maybe I didn't used the DeInterlace filter before but just thought I did because MediaInfo showed the old files as progressive?

So I think somehow the Yadif() DeInterlacing doesn't really work for me. But I can live without that.


A couple more questions if I might ask.
Does the graph work as a template for all files I want to convert or do I need to create a new graph for each file?
And should I add the ConvertToYV12() like in the standard options or is this not necessary?

Anyway thank you already for your help. I really appreciate it.
Attached Images
 
suckerpuncher is offline   Reply With Quote
Old 13th January 2013, 20:14   #8  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by suckerpuncher View Post
Does the graph work as a template for all files I want to convert or do I need to create a new graph for each file?
New one for each file.

Quote:
Originally Posted by suckerpuncher View Post
And should I add the ConvertToYV12() like in the standard options or is this not necessary?
Since 99% of all source material (TV, DVD, Blu-Ray) already is YV12 it probably does not make any difference.
sneaker_ger is offline   Reply With Quote
Old 13th January 2013, 20:56   #9  |  Link
suckerpuncher
Registered User
 
Join Date: Jun 2005
Posts: 11
Once again - Thank you!
suckerpuncher is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:02.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.