Hi Klaus,
On 23.07.2011 16:57, Klaus Schmidinger wrote:
The VDR plugin 'pictures' (part of the original VDR archive)
uses a Perl script named 'pic2mpg', which converts a JPEG
image into an MPEG frame that can be displayed directly
by VDR's primary output device. This is done in essence
by the command sequence
jpegtopnm $Pict |
pnmscale --xscale=$ScaleW --yscale=$ScaleH |
pnmpad --black --width $SW --height $SH |
ppmtoy4m -F $framerate -I p -S 420mpeg2 |
mpeg2enc -f 3 -b 12500 -a $aspect -q 1 -n $system2 -o $Mpeg
(see the actual script for the complete working environment).
While this works fine for SD video, I can't seen to figure
out how to make this work for an HD video output device.
The video frame should be a 1080i frame in my case (my tv
can't handle 1080p), but could optionally also be 720p or
1080p, depending on the actual tv's capabilities.
Can anybody give me a pointer how this script could generate
HD video frames?
I have not used mpeg2enc at all. I usually use convert from ImageMagick
and ffmpeg to convert things. You might want to give those two a try.
Here are two simple lines to convert a jpg image to mpeg2:
convert $Pict -background '#000000' -resize 1920x1080 -gravity center
-extent 1920x1080 /tmp/test.jpg
ffmpeg -i /tmp/temp.jpg -an -vcodec mpeg2video -b 2500 -s 1920x1080
-qscale 2 -f mpeg2video $Mpeg
Note: Depending on your distro, ffmpeg may not support mpeg2 video encoding.
For mpeg4 the ffmpeg line looks like this:
ffmpeg -i /tmp/temp.jpg -an -vcodec mpeg4 -b 2500 -s 1920x1080 -qscale 2
-threads 4 -f mp4 $Mpeg
For libx264 it looks like this:
ffmpeg -i /tmp/temp.jpg -an -vcodec libx264 -vpre lossless_ultrafast -s
1920x1080 -qscale 2 -threads 4 -f mp4 $Mpeg
The -vpre parameter requires a preset. They can usually be found under
/usr/share/ffmpeg/libx264-*.ffpreset.
If you want a 10 second video at 25 fps, you can do it like this:
ffmpeg -loop_input -t 10 -r 25 -i /tmp/temp.jpg -an -vcodec mpeg4 -b
2500 -s 1920x1080 -qscale 2 -threads 4 -f mp4 $Mpeg
You may want to adjust the number of threads according to the number of
cores in your machine.
André
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr