Re: encoding mp4 to mpeg2 DVD format

Bernhard Praschinger <[email protected]>
Newsgroups gmane.comp.video.mjpeg.user
Message-ID <[email protected]>
Hallo

Well for the first try doing it by hand can be helpful.

> Well after a few hours of running the script:
> #!/bin/ksh
> [ $# -lt 2 ] && echo 'Usage: $0 <file.mp4> <file.mpg>' && exit 1
> mkfifo stream.yuv
> cat stream.yuv | mpeg2enc -f 8 -o video.m2v &
> mplayer -nosound -noframedrop -vo yuv4mpeg $1
>
> # The thing slightly missing is the audio decoding/ encoding:
> mplayer -vo null -ao pcm:fast $1
> cat audiodump.wav | mpeg2enc -r 48000 -o audio.mp2
>
> # and than mplex it together with:
> mplex -f 8 audio.mp2 video.m2v -o $2
>
>
> it ended with the following error messages:

> Playing /sdb4/Misc/Media/Jesus_Christ_SuperStar.mp4.
> libavformat file format detected.
> [lavf] stream 0: video (h264), -vid 0
> [lavf] stream 1: audio (aac), -aid 0, -alang und
> VIDEO:  [H264]  450x360  24bpp  25.000 fps  379.7 kbps (46.4 kbyte/s)
One problem here is the screen resolution you need to scale it to a DVD 
compliant size, that can be done with yuvscaler (-O DVD) for example, 
you than probably need to set the aspect ratio correct (mpeg2enc -a 
option) and if everything goes wrong the correct framerate (yuvfps)

> Clip info:
>    major_brand: mp42
>    minor_version: 0
>    compatible_brands: isommp42
>    creation_time: 2012-08-26 15:53:18
> Load subtitles in /sdb4/Misc/Media/
> ==========================================================================
> Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
> Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
> ==========================================================================
> ==========================================================================
> Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
> AUDIO: 44100 Hz, 2 ch, s16le, 96.0 kbit/6.80% (ratio: 11999->176400)
> Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
> ==========================================================================
> [AO PCM] File: audiodump.wav (WAVE)
> PCM: Samplerate: 44100Hz Channels: Stereo Format s16le
> [AO PCM] Info: Faster dumping is achieved with -benchmark -vc null -vo
> null -ao pcm:fast
> [AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).
> AO: [pcm] 44100Hz 2ch s16le (2 bytes per sample)
> Starting playback...
> Unsupported PixelFormat 61
> Unsupported PixelFormat 53
> Movie-Aspect is undefined - no prescaling applied.
> VO: [null] 450x360 => 450x360 Planar YV12
> A:   2.6 V:   2.3 A-V:  0.281 ct:  0.040   0/  0 11%  0% 0.8% 53 0
>
>
>              ************************************************
>              **** Your system is too SLOW to play this!  ****
>              ************************************************
>
> /> the SLOW message is strange as mplayer has no problems playing this
> mp4 file!/
>
> Possible reasons, problems, workarounds:
> - Most common: broken/buggy _audio_ driver
>     - Try -ao sdl or use the OSS emulation of ALSA.
>     - Experiment with different values for -autosync, 30 is a good start.
>
>
>      Exiting... (End of file)
>      **ERROR: [mpeg2enc] -r option requires arg 0 .. 32
>
>      INFO: [mplex] mplex version 2.0.0 (2.2.7 $Date: 2010/03/13 13:05:07 $)
>      **ERROR: [mplex] Unable to open file audio.mp2 for reading.

So to find the problem please check if the audio file was generated 
correct with mpg123 or mplayer. You should get a output like that for 
mpg123: mpg123 audio.mp2
...
Playing MPEG stream 1 of 1: audio_48.mp2 ...
MPEG 1.0 layer II, 224 kbit/s, 48000 Hz stereo

and for mplayer:
...
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 224.0 kbit/14.58% (ratio: 28000->192000)

 From the log I'd think the mpeg2enc command is broken.
I'd guess that you nedd to add at least the yuvscaler command so the 
command looks something like that:
cat stream.yuv | yuvscaler -O DVD | mpeg2enc -f 8 -o video.m2v &

If you don't get a video file I need the output of the command. And if 
multiplexing fails also the output of mplex.

auf hoffentlich bald,

Berni the Chaos of Woodquarter

Email: [email protected]
www: http://www.lysator.liu.se/~gz/bernhard

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.