Log in

View Full Version : How to encode YUV files into mpeg2 ?


laminar
31st May 2007, 11:52
First, thanks a lot for this amazing forum !

I'm trying to find a way to encode YUV 4:2:0 Raster format files (with no header) into mpg2 with a high quality.
Which freeware (or shareware) can I use for that purpose ?
Help would be highly appreciated :thanks:

buzzqw
31st May 2007, 12:08
never tryed myself (don't have such file to test...) but give a chance to Mencoder/ffmpeg :)

BHH

45tripp
31st May 2007, 14:07
http://www.deepfriedpizza.co.uk/software/yuvfileplayer/indexSupport.html

several dead links but lots of leads.
give dear emily a whirl

gl

laminar
31st May 2007, 14:25
never tryed myself (don't have such file to test...) but give a chance to Mencoder/ffmpeg :)

BHH

I tried but I didn't find any way to read YUV files !

laminar
31st May 2007, 14:31
http://www.deepfriedpizza.co.uk/software/yuvfileplayer/indexSupport.html

several dead links but lots of leads.
give dear emily a whirl

gl

Thanks but I only found dead links or links to YUV players.

I think Mencoder may be THE solution but I don't know how to use it properly.

45tripp
31st May 2007, 16:20
Emily is more than a viewer.
Good to see you tried.

I managed to convert using emily in conjuction with morgan mjpeg.

here is a stripped down mencoder command:
mencoder 720pparkrun.yuv -demuxer rawvideo -rawvideo w=1280:h=720
-ovc lavc -lavcopts vcodec=mpeg4 -nosound -ffourcc XVID -o op.avi

I had a problem with the clip running to 600 frames when images were only up to ~400 but I don't know if it's a source problem or conversion problem.
First attempt for me with this.
Nothing major anyway.

gl

laminar
1st June 2007, 10:16
Emily is more than a viewer.
Good to see you tried.

I managed to convert using emily in conjuction with morgan mjpeg.

here is a stripped down mencoder command:
mencoder 720pparkrun.yuv -demuxer rawvideo -rawvideo w=1280:h=720
-ovc lavc -lavcopts vcodec=mpeg4 -nosound -ffourcc XVID -o op.avi

I had a problem with the clip running to 600 frames when images were only up to ~400 but I don't know if it's a source problem or conversion problem.
First attempt for me with this.
Nothing major anyway.

gl

Thanks a lot for the command line ! this is exactly what I'm looking for...
I'm gonna try and keep you informed of the result.

laminar
1st June 2007, 12:50
With the following command line I succeeded to generate a mpeg4 stream (well decoded by VLC but not by WMV10) :
mencoder SA00054.yuv -demuxer rawvideo -rawvideo w=320:h=240 -ovc lavc -lavcopts vcodec=mpeg4 -nosound -ffourcc XVID -o SA00054.avi

I then replaced vcodec=mpeg4 by vcodec=mpeg2. The generated stream is not readable either by VLC or WMV10
I also tried mpeg1 and ffv1 codecs with no success :-(
Any idea bros ?

45tripp
1st June 2007, 15:01
don't really know what you want to do,
i'll just say if you're going to mpeg2 you'll obviously want to resize. no?
Anyway some examples.
read up for more.


mencoder SA00054.yuv -demuxer rawvideo -rawvideo
w=320:h=240 -ovc xvid -xvidencopts fixed_quant=3 -ffourcc DX50 -nosound -o SA00054.avi



mencoder SA00054.yuv -demuxer rawvideo -rawvideo w=320:h=240
-vf scale=720:480 -ovc lavc -lavcopts vcodec=mpeg2video:autoaspect:vqmin=1:lmin=0.01:
vqblur=0:vqscale=2:vrc_maxrate=9800:vrc_buf_size=1835:keyint=15:me_range=128:mbd=2
:aspect=4/3 -of rawvideo -ffourcc MPG2 -nosound -o SA00054.m2v



mencoder SA00054.yuv -demuxer rawvideo -rawvideo w=320:h=240 -of mpeg -ovc lavc -lavcopts
vcodec=mpeg1video:vbitrate=800:vrc_minrate=100:vrc_maxrate=500:
vrc_buf_size=300 -audiofile whatever.wav -oac lavc -lavcopts acodec=mp2:abitrate=96
-o SA00054.mpg

laminar
1st June 2007, 16:43
Thanks Immersion for your examples.
I succeded to generate a mpeg2 stream with the following command line : mencoder SA00054.yuv -demuxer rawvideo -rawvideo w=320:h=240 -ovc lavc -lavcopts vcodec=mpeg2video -of rawvideo -ffourcc MPG2 -nosound -o SA00054.m2v

I don't understand all the options, like "-ffourcc MPG2" !
I need to go more in details, as this tool appears really powerful and complex in the same time.

I work on a transcoder from mpeg2 to h264. For that purpose I want to encode a set of YUV files into mpeg2. It will be a start point for my transcoding feature.

I need to encode Frame and field based streams with a high quality, so I don't really care of the bitrate. How could I force mencoder to use a high bitrate ?
How could I generate a field stream ?
I parsed the encoded stream, it seems that it is IP only (no B frames). Is there a way to force it to encode with B frames ?

Is there a "tutorial for newbies" somewhere ? :)

45tripp
2nd June 2007, 00:02
Why not just seek out mpeg2 samples?

brames
mencoder SA00054.yuv -demuxer rawvideo -rawvideo w=320:h=240
-vf scale=720:480 -ovc lavc -lavcopts vcodec=mpeg2video:autoaspect:vqmin=1:lmin=0.01:
vqblur=0:vqscale=2:vrc_maxrate=9800:vrc_buf_size=1835:keyint=15:vmax_b_frames=2:
me_range=128:mbd=2:dc=9:aspect=4/3 -of rawvideo -ffourcc MPG2 -nosound -o SA00054.m2v


high bitrate, bframes
mencoder SA00054.yuv -demuxer rawvideo -rawvideo w=320:h=240
-ovc lavc -lavcopts vcodec=mpeg2video:vqscale=2:keyint=15:vmax_b_frames=2
-of rawvideo -ffourcc MPG2 -nosound -o SA00054.m2v


I don't know if mencoder can encode to a field based picture structure.
I've only seen a field based option in procoder.

Is there a "tutorial for newbies" somewhere ? :)
good luck :)
I'm just a noob. read the manual

Wilbert
3rd June 2007, 13:34
YUV 4:2:0 Raster format files
Are those raw YUV files? If so you can convert them with AviSynth (RawSource) and QuEnc/HCEnc.

45tripp
3rd June 2007, 19:34
Good idea, I'd been meaning to try the filter.

http://avisynth.org/warpenterprises/

rawsource("720pparkrun.yuv",1280,720,"I420")

laminar
7th June 2007, 08:44
Sorry for not replying before...I was out for a few days.
I'm gonna try what you proposed and keep you informed.

laminar
7th June 2007, 12:26
Are those raw YUV files? If so you can convert them with AviSynth (RawSource) and QuEnc/HCEnc.

RawSource + QuEnc is a MUST !
I'm used to rip with dvd rebuilder + QuEnc, but I didn't know how to use QuEnc separetly from DVD rebuilder....:thanks:
I will also try HCEnc (I'm not familiar with this one).

Is there a way to use QuEnc in command line ?
I have a lot of Raw files to convert into mpeg2

laminar
7th June 2007, 13:03
HCEnc is great also !
Many parameters to set the mpeg output.
I just need a way to generate 100s of streams with a batch command line...

Guest
7th June 2007, 13:16
HCEnc has a CLI.

smok3
7th June 2007, 13:33
Is there a way to use QuEnc in command line ?
yes there is, check http://forum.doom9.org/showthread.php?t=126636 for my example.

laminar
7th June 2007, 14:33
yes there is, check http://forum.doom9.org/showthread.php?t=126636 for my example.

Thanks for the example. I succeeded to use the CLI.
I will try the same with HCEnc as I think I have more parameters available versus QuEnc

smok3
7th June 2007, 15:46
you can use ini with hcenc, so the command is like:

"t:\utility\HC021\HCenc_021.exe" -i "in.avs" -o "out.m2v" -ini "t:\utility\HC021\43_progresive.ini"

and ini could look like:
*MAXBITRATE 8000
*PROFILE best
*ASPECT 4:3
*CQ_MAXBITRATE 5.000
*PREVIEW
*MATRIX mpeg

laminar
7th June 2007, 17:02
you can use ini with hcenc, so the command is like:

"t:\utility\HC021\HCenc_021.exe" -i "in.avs" -o "out.m2v" -ini "t:\utility\HC021\43_progresive.ini"

and ini could look like:
*MAXBITRATE 8000
*PROFILE best
*ASPECT 4:3
*CQ_MAXBITRATE 5.000
*PREVIEW
*MATRIX mpeg

Thanks a lot smok3. I will try that.