Log in

View Full Version : mencoder: JPG to HD-mpeg2 via Linux


Slugshot
20th September 2010, 23:13
Hi,

I try to create a m1v file with mpeg codec from a single jpeg (used as background picture for Dreambox satellite receivers) with the following specs:

Format : MPEG Video
Format version : Version 2
File size : 90.5 KiB
Duration : 33ms
Overall bit rate : 22.5 Mbps

Video
Format : MPEG Video
Format version : Version 2
Format profile : Main@High
Format settings, Matrix : Default
Duration : 33ms
Bit rate mode : Variable
Bit rate : 19.4 Mbps
Width : 1280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 30.000 fps
Standard : Component
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.310
Stream size : 78.1 KiB (86%)


This one was created with mpeg2enc and plays fine on my Dreambox. I used following code to created the file:
mpeg2enc <path to input *.yuv> -v 0 -f 13 -x xRES -y yRES -a 3 -4 1 -2 1 -q 1 -H --level high -o <path to output *.m1v

The input for mpeg2enc is a JPEG file transformed with the following code:
jpeg2yuv -v 0 -f 30 -n1 -I p -A 16:9 -j <path to input *.jpg>


But when i try to create an equivalent *.m1v file with mencoder the mediainfo looks like follows and wonīt be played on my Dream:

Format : MPEG-PS
File size : 146 KiB
Duration : 33ms
Overall bit rate : 29.9 Mbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format settings, Matrix : Default
Duration : 33ms
Bit rate mode : Variable
Width : 1280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 30.000 fps
Scan type : Progressive


I used following code to create the m1v with mencoder:
mencoder mf://<path to input *.jpg> -mf fps=30:type=jpg -ovc lavc -lavcopts vcodec=mjpeg -o <path to output *.m1v>

I also tried the "-of mpeg" flag without getting a playable result.

Enclosed you will find the playable m1v I created with mpeg2enc.

I need to use mencoder on a Linux system to create my file with the specs from the one created with mpeg2enc. No other tools are available. It would be nice to hear any suggestions.

So far
Andy

Slugshot
23rd September 2010, 09:02
In both cases the output can be played on my workstation. Thats not the deal. Only playback on my Dreambox wonīt work. :-(

Any suggestions?! :confused::confused:

pandy
23rd September 2010, 12:27
mjpeg is not mpeg (1 or 2)
m1v is not mpeg-2 but elementary mpeg-1 video

are You interested in 1 picture coded as so called "still" for use with dbox or sequence pictures?

Slugshot
23rd September 2010, 15:11
I played with a variant of encode options. MJPEG is only the last i tried.
Yes, I want "still" pictures. I just can say that the mpeg2 codec in an mpg1 container is the one which works...
I got the movie information from "MediaInfo", but if further information are needed, i can provide it.

Midzuki
24th September 2010, 02:04
I played with a variant of encode options. MJPEG is only the last i tried.

So, the option "-lavcopts vcodec=mpeg1video" didn't give you what you're looking for? :confused: :confused: :confused:

Slugshot
24th September 2010, 08:41
If I use

mencoder mf://<path to input *.jpg> -mf fps=30:type=jpg -ovc lavc -lavcopts vcodec=mpeg1video -o <path to output *.m1v>

the result will look like follows:

Format : MPEG-PS
File size : 146 KiB
Duration : 33ms
Overall bit rate : 29.9 Mbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 1
Format settings, Matrix : Default
Duration : 33ms
Bit rate mode : Variable
Width : 1280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 30.000 fps
Scan type : Progressive

But i canīt play it on my Dream :confused::confused:

I would like to generate the output as close as possible to the one I created with mpeg2enc...
Currently I see the following differences:
Format profile : Main@High
Standard : Component
Colorimetry : 4:2:0

Is it possible that this causes the playback error?

pandy
24th September 2010, 10:16
please test this file http://hotfile.com/dl/71400855/9cafc7d/IMG.mpg.html

Slugshot
24th September 2010, 20:52
IT WORKS!!!! :thanks:

What was your code?

TXH!!
Andy

pandy
27th September 2010, 10:14
ffmpeg -i %1 -an -f mpeg2video -r 30.0 -vcodec mpeg2video -intra -sc_threshold 1000000000 -flags +mv0+cgop -dc 8 -g 1 -me_method zero -qscale %2 -bf 0 -aspect 16:9 %1.mpg

try this one - should work - previous use 3 parameters (i've created some *.cmd for windows thuse You need to replace windows syntax with proper syntax for Linux - passing parameter for script + passing parameters for ffmpeg)

former script use bitrate instead Q scale etc so i modified a bit script to be more useful from still generation point of view

i use FFmpeg version SVN-r24068

Slugshot
29th September 2010, 22:04
I tested some Qscale settings and qscale=5 results in the best combination for me between quality and filesize.

:thanks:

pandy
30th September 2010, 16:52
You're welcome! Good to know that it was useful for You.