Log in

View Full Version : Convert DVB-s2 H264 to x264


friends-fan
25th August 2006, 15:31
Hi,

as i recently aquired the possibilty to capture the new dvb-s2 streams to my HDD, i now wanted to convert them to x264 (i can capture as either ts or mpeg). Even though it might sound silly at first glance (h264 to x264) it can yield very nice results (with flaws still to explain) :D

I tried the usual candidates (Megui, StaxRip) mostly and ran into varies problems. I cant state everything that i tried here, as it is simply way too much and i dont recall all of it :p .

Problems are:

a) Almost any of the One Klick solutions dont accept the h264 files as they expect mpeg2 and such (avs works partly, more later)

b) Cutting doesnt work

c) Output is async

Where i had partly success:

I used the Direct Show Filter with Staxrip and let the audio demux with the projectx Option (Video was ignored of course). I could then import my captured stream as MPEG file. I can view and cut then within the means of the program. But when it gets to the actual cutting part, VDUB fails with an error bout Duplicate Filenames or something (cutting "real" Mpeg2 source works just fine). If i ignore the cutting and just encode, the output is async. Fixing that can be done with demuxing again and mux with an audio delay. Still needs to be cut which i couldnt do.

Other approach is with the avs file. If i create it, i can feed the video to the Encoding program. The async and cutting problems remain though.

I also tried changing to mkv container first by demuxing to raw streams and then remuxing/mp4box. There of course i run in the problems with the need of deleting parts from the file with hexeditor and stuff (which isnt really practible with average 5 GB Files :D ) Otherwise i get a "non compliant bitstream" when trying to change to mux the raw stream to mp4.

So i guess it would be easiest, if projextx for example would support h264. I assume, the async problem could be taken care of then like it does with mpeg2.

It just would be nice if someone who already tried doing that too and maybe has some new input for me could say something to the matter.

Sorry if the post is a little unstructured in parts, but i really tried so much different things, its hard to keep track.

bond
25th August 2006, 16:59
directshowsource in avisynth as source for x264 cli -> mp4 ready ;)

friends-fan
25th August 2006, 17:35
directshowsource in avisynth as source for x264 cli -> mp4 ready ;)

wow, you have to be little slower with me here...:o

First i would need to understand your basic idea. I just use the x264 to put my file (the raw h264) in mp4 container and then reencode or am i supposed to do with command line what the GUIs usually do? Anyway, what i tried is:

make sat1.avs including just

DirectShowSource("G:\sat1.mpg")

I can "play" it when starting the avs with MPC for example. Just picture of course.

So now i did

G:\mplayer>x264.exe -o g:\sat1.mp4 g:\sat1.avs --sar 1920:1080
avis [error]: unsupported input format (YUY2)
x264 [error]: could not open input file 'g:\sat1.avs'

So you already lost me here...:( Do i need to change some settings to make the h264 file another format (YUV 4:2:0)?

bond
25th August 2006, 17:45
add converttoyv12() at the end of your avs script

x264.exe is only for reencoding to avc in mp4

if you dont want to reencode your stream, but only place the capture into mp4 you need to demux the raw stream from the mpg (eg with mplayer or mencoder) and than mux the raw stream into mp4 with mp4box or mp4creator

friends-fan
25th August 2006, 18:41
No, i do want to shrink the original h264 file using x264 and therefore retaining the awesome quality :D

I now managed to reencode the file with the x264 command. However thats basicly the same that Staxrip does if i feed it with my mpeg file. It creates the avs file and adds the things i want to do (cut, add the yuv12, resize). Then however i encounter the problems i mentioned before with async and cutting not working.

DirectShowSource("G:\sat1.mpg")
Crop(244,2,-244,-14)
BicubicResize(768,576,0,0.5)
ConvertToYV12()
Trim(0,472) + Trim(672,1376)

Thats the avs file that gets created. And with that i get the first error in while cutting

http://img243.imageshack.us/img243/1742/1xt9.jpg

Processing without cutting works, but leads me to an async output which i could fix by remuxing with according audio delay. Still leaves with the need to cut the thing after encoding in that case.

Maybe if i use the trim settings to cut the audio seperatly in vdub? And then i could remux the cut audio and cut video? Then again, i dont even get an "audio" menu point in vdubmod, just "video".

You have the means to capture h264 streams? Or should i put the sample (90 MB) somewhere? So maybe you can take a look at it?

bond
26th August 2006, 12:51
directshowsource is not good for trim. try setting the fps in directshowsource, this might help