[MPlayer-users] Reencoding a broadcast HD-ATSC stream
Philip Prindeville
philipp_subx at redfish-solutions.com
Sun Nov 20 18:04:50 CET 2005
RC wrote:
>On Thu, 17 Nov 2005 21:08:51 -0600
>Kichigai Mentat <kichigai at comcast.net> wrote:
>
>
>
>>High bitrate (approximately half of the MPEG-2 TS, I'd say, about 1.5
>>MBit, but many people use around 700-800 Kbits,
>>
>>
>
>If you're encoding a 1920x1080 video with a bitrate of 700k, it will
>certainly be unwatchable. Even 1500 is optimistic.
>
>
>
>>As far as audio, your call. Use Vorbis instead of MP3 if that's an
>>option, but also consider FLAC is size isn't an option.
>>
>>
>
>Nobody would consider using FLAC for HDTV, which is already in AC3.
>You'd just waste a lot of space encoding to FLAC, rather than copying
>the AC3 stream.
>
>Vorbis or MP3 are fine, if you want to downmix to stereo. If you want
>to keep 5.1 audio, just copy the AC3 stream into the output.
>
>
>
>
Here's the script I was using:
#!/bin/sh
bitrate=20000
for file in "$@"; do
dir=`dirname $file`
base=`basename $file .ts`
prog=`echo $base | sed 's/.*\.\([0-9]\)$/\1/'`
base=`echo $base | sed "s/\.$prog$//"`
base="$dir/$base"
echo "pass 0..."
mencoder -quiet -oac copy -ovc frameno -tsprog $prog -o $dir/frameno.avi
$file
for pass in 1 2; do
echo "pass $pass..."
echo mencoder -quiet -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$bitrate:vpass=$pass \
-vf pp=hb/vb/dr/al/lib \
-vop scale=1920:1080,crop=1920:1080 -tsprog $prog \
-o "$base.avi" "$file"
mencoder -quiet -sws 2 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=$bitrate:vpass=$pass \
-vf pp=hb/vb/dr/al/lib \
-vop scale=1920:1080,crop=1920:1080 -tsprog $prog \
-o "$base.avi" "$file"
done
rm -f $dir/frameno.avi
done
But I'm seeing the following output when I ran it:
[root at pvr ~]# recode /home/share/videos/IdahoEdens.7.ts
pass 0...
MEncoder dev-CVS-051008-15:57-3.4.4 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon 64 Clawhammer (Family: 15, Stepping: 10)
Detected cache-line size is 64 bytes
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2
success: format: 0 data: 0x0 - 0x96722f90
TS file format detected.
DEMUX OPEN, AUDIO_ID: -1, VIDEO_ID: -1, SUBTITLE_ID: -1,
PROBING UP TO 2000000, PROG: 7
VIDEO MPEG2(pid=113)AUDIO A52(pid=116) NO SUBS (yet)! PROGRAM N. 7
Opened TS demuxer, audio: 2000(pid 116), video: 10000002(pid 113)...POS=564
VIDEO: MPEG2 1920x1088 (aspect 3) 29.970 fps 14490.0 kbps (1811.2 kbyte/s)
[V] filefmt:29 fourcc:0x10000002 size:1920x1088 fps:29.97 ftime:=0.0334
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
AC3: 2.0 (stereo) 48000 Hz 256.0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=32000
sample-244813135873)
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
TS_PARSE: COULDN'T SYNC
Writing AVI index...
Fixing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
Recommended video bitrate for 650MB CD: 1253
Recommended video bitrate for 700MB CD: 1370
Recommended video bitrate for 800MB CD: 1603
Recommended video bitrate for 2 x 650MB CD: 2770
Recommended video bitrate for 2 x 700MB CD: 3004
Recommended video bitrate for 2 x 800MB CD: 3470
Video stream: 0.959 kbit/s (119 B/s) size: 430844 bytes 3594.458 secs
107715 frames
Audio stream: 256.000 kbit/s (32000 B/s) size: 115010992 bytes 3594.094
secspass 1...
mencoder -quiet -sws 2 -oac copy -ovc lavc -lavcopts
vcodec=mpeg4:vbitrate=20000:vpass=1 -vf pp=hb/vb/dr/al/lb -vop
scale=1920:1080,crop=1920:1080 -tsprog 7 -o
/home/share/videos/IdahoEdens.avi /home/share/videos/IdahoEdens.7.ts
MEncoder dev-CVS-051008-15:57-3.4.4 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon 64 Clawhammer (Family: 15, Stepping: 10)
Detected cache-line size is 64 bytes
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2
success: format: 0 data: 0x0 - 0x96722f90
TS file format detected.
DEMUX OPEN, AUDIO_ID: -1, VIDEO_ID: -1, SUBTITLE_ID: -1,
PROBING UP TO 2000000, PROG: 7
VIDEO MPEG2(pid=113)AUDIO A52(pid=116) NO SUBS (yet)! PROGRAM N. 7
Opened TS demuxer, audio: 2000(pid 116), video: 10000002(pid 113)...POS=564
VIDEO: MPEG2 1920x1088 (aspect 3) 29.970 fps 14490.0 kbps (1811.2 kbyte/s)
[V] filefmt:29 fourcc:0x10000002 size:1920x1088 fps:29.97 ftime:=0.0334
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
AC3: 2.0 (stereo) 48000 Hz 256.0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [pp=hb/vb/dr/al/lb]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 1920 x 1088 (preferred csp: Mpeg PES)
[PP] Using external postprocessing filter, max q = 6.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Also try adding the scale filter, e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=32000
sample-244813135873)
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
VDec: vo config request - 1920 x 1088 (preferred csp: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: libavcodec (1920x1088 fourcc=34504d46 [FMP4])
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
ODML: Starting new RIFF chunk at 1023MB.
TS_PARSE: COULDN'T SYNC
Flushing video frames
Writing AVI index...
Fixing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
Video stream: 2507.478 kbit/s (313434 B/s) size: 1126627943 bytes
3594.458 secs 107715 frames
Audio stream: 256.000 kbit/s (32000 B/s) size: 115010992 bytes 3594.094
secspass 2...
mencoder -quiet -sws 2 -oac copy -ovc lavc -lavcopts
vcodec=mpeg4:vbitrate=20000:vpass=2 -vf pp=hb/vb/dr/al/lb -vop
scale=1920:1080,crop=1920:1080 -tsprog 7 -o
/home/share/videos/IdahoEdens.avi /home/share/videos/IdahoEdens.7.ts
MEncoder dev-CVS-051008-15:57-3.4.4 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Athlon 64 Clawhammer (Family: 15, Stepping: 10)
Detected cache-line size is 64 bytes
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2
success: format: 0 data: 0x0 - 0x96722f90
TS file format detected.
DEMUX OPEN, AUDIO_ID: -1, VIDEO_ID: -1, SUBTITLE_ID: -1,
PROBING UP TO 2000000, PROG: 7
VIDEO MPEG2(pid=113)AUDIO A52(pid=116) NO SUBS (yet)! PROGRAM N. 7
Opened TS demuxer, audio: 2000(pid 116), video: 10000002(pid 113)...POS=564
VIDEO: MPEG2 1920x1088 (aspect 3) 29.970 fps 14490.0 kbps (1811.2 kbyte/s)
[V] filefmt:29 fourcc:0x10000002 size:1920x1088 fps:29.97 ftime:=0.0334
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
AC3: 2.0 (stereo) 48000 Hz 256.0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [pp=hb/vb/dr/al/lb]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 1920 x 1088 (preferred csp: Mpeg PES)
[PP] Using external postprocessing filter, max q = 6.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Also try adding the scale filter, e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=32000
sample-244813135873)
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
VDec: vo config request - 1920 x 1088 (preferred csp: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: libavcodec (1920x1088 fourcc=34504d46 [FMP4])
[mpeg4 @ 0xa772f0]requested bitrate is to low
Could not open codec.
FATAL: Cannot initialize video driver.
Exiting...
[root at pvr ~]#
This was written using an example from the pchdtv forum...
-Philip
More information about the MPlayer-users
mailing list