[MPlayer-users] Looking for pointers: conversion of DTivo .ty files to mpeg4

Mark Mason purplemark at mac.com
Sat May 8 21:44:56 CEST 2004


Hello all,

I'm attempting to convert some Tivo .ty files to DiVx (mpeg4), and am  
running into a couple of problems.  Any help with command line args, or  
pointers on how to go about debugging these problems would be greatly  
appreciated.  I'm interested in getting into the code, but am pretty  
much a rank beginner on digital video code at this point.

These .ty files were extracted with tyStudio from a DTivo (Series 1).   
I've given up on using tyStudio for the .ty -> .mpg conversion, as the  
audio always seems to end up a lot choppier than just using  
mplayer/mencoder on the .ty stream directly.

I'm running the latest mplayer and mencoder (CVS as of last night).  My  
host is MacOS X (dual G5).

I'm building with --enable-debug.  The problems I'm having are present  
in both debug and non-debug builds.

If there's different or additional information I should be providing,  
please let me know.

General question: can anyone recommend a good starting point for video  
filters/options for this type of conversion?  I'm particularly  
interested in any advice on the right way to handle the apparently  
frequent frame-rate changes (29.970 fps -> 23.976 fps and back again).   
I've read the telecine/interlace/progressive part of the manual, but  
that advice seems aimed more at DVD video which (apparently) has fewer  
back and forth switches.

First issue: Attempting a 3-pass encoding, mencoder core dumps on the  
26th frame.  I'm assuming this is a bug, but I may have also done  
something wrong with the command line args.  I've not really gotten far  
enough into the code to debug this, but it looks like there's an  
assumption that a vfilter should be present (and it's missing).

+ rm -f frameno.avi
+ /Users/markmason/sourceforge/mplayer/main/mencoder -v 'Dateline  
NBC-Behind_ The Apprentice.ty' -ovc frameno -oac mp3lame -lameopts  
cbr:br=128 -o frameno.avi

TiVo file format detected.
Searching for sequence header... OK!
VIDEO:  MPEG2  480x480  (aspect 2)  29.970 fps  15000.0 kbps (1875.0  
kbyte/s)
[V] filefmt:33  fourcc:0x10000002  size:480x480  fps:29.97   
ftime:=0.0334
======================================================================== 
==
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
dec_audio: Allocating 4608 + 65536 = 70144 bytes for output buffer.
mp3lib: using generic C decore!
MP3lib: init layer2&3 finished, tables done
MPEG 1.0, Layer II, 48000 Hz 160 kbit Joint-Stereo, BPF: 480
Channels: 2, copyright: Yes, original: Yes, CRC: No, emphasis: 0
AUDIO: 48000 Hz, 2 ch, 16 bit (0x20), ratio: 20000->192000 (160.0 kbit)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
======================================================================== 
==
MP3 audio selected
Building audio filter chain for 48000Hz/2ch/16bit ->  
48000Hz/2ch/16bit...
[libaf] Adding filter dummy
[dummy] Was reinitialized, rate=48000Hz, nch = 2, format = 0x00000000  
and bps = 2
[dummy] Was reinitialized, rate=48000Hz, nch = 2, format = 0x00000000  
and bps = 2
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not  
writing vprp header.
LAME version 3.97 (alpha 1, May  8 2004 01:41:42)  
(http://www.mp3dev.org/)
warning: alpha versions should be used for testing only
Using polyphase lowpass filter, transition band: 17226 Hz - 17806 Hz

[snip]

Pos:   0.9s     26f ( 0%)   0fps Trem:   0min   0mb  A-V:-0.013 [0:127]  
A/Vms 2/0 D/B/S 0/0/0
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00005488 in main (argc=384, argv=0x1) at mencoder.c:1323
1323            if (!encode_duplicates || ((vf_instance_t  
*)sh_video->vfilter)->control(sh_video->vfilter,  
VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
(gdb) p sh_video
$1 = (sh_video_t *) 0x1908f50
(gdb) p sh_video->vfilter
$2 = (void *) 0x0
(gdb) l
1318    if(skip_flag<0){
1319        // duplicate frame
1320            if(file_format != DEMUXER_TYPE_TV && !verbose)  
printf(MSGTR_DuplicateFrames,-skip_flag);
1321        while(skip_flag<0){
1322            duplicatedframes++;
1323            if (!encode_duplicates || ((vf_instance_t  
*)sh_video->vfilter)->control(sh_video->vfilter,  
VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
1324                muxer_write_chunk(mux_v,0,0);
1325            ++skip_flag;
1326        }
1327    } else


Second issue: when trying a two-pass encoding (having given up on  
3-pass),

+ rm -f frameno.avi
+ /Users/markmason/sourceforge/mplayer/main/mencoder -v 'Dateline  
NBC-Behind_ The Apprentice.ty' -vf scale=640:480,crop=638:476:2:2 -ovc  
lavc -lavcopts vcodec=mpeg4:vhq:v4mv:trell:vpass=1 -oac mp3lame  
-lameopts cbr:br=128 -o /dev/null

TiVo file format detected.
Searching for sequence header... OK!
VIDEO:  MPEG2  480x480  (aspect 2)  29.970 fps  15000.0 kbps (1875.0  
kbyte/s)
[V] filefmt:33  fourcc:0x10000002  size:480x480  fps:29.97   
ftime:=0.0334
======================================================================== 
==
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
dec_audio: Allocating 4608 + 65536 = 70144 bytes for output buffer.
mp3lib: using generic C decore!
MP3lib: init layer2&3 finished, tables done
MPEG 1.0, Layer II, 48000 Hz 160 kbit Joint-Stereo, BPF: 480
Channels: 2, copyright: Yes, original: Yes, CRC: No, emphasis: 0
AUDIO: 48000 Hz, 2 ch, 16 bit (0x20), ratio: 20000->192000 (160.0 kbit)
Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)
======================================================================== 
==
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1  (-1=autodetect) osd: 1
Opening video filter: [crop w=638 h=476 x=2 y=2]
Crop: 638 x 476, 2 ; 2
Opening video filter: [scale w=640 h=480]
SwScale params: 640 x 480 (-1=no scaling)
======================================================================== 
==
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 480 x 480 (preferred csp: Mpeg PES)
Trying filter chain: scale crop expand lavc
The selected video_out device is incompatible with this codec.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.3.1
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
======================================================================== 
==
MP3 audio selected
Building audio filter chain for 48000Hz/2ch/16bit ->  
48000Hz/2ch/16bit...
[libaf] Adding filter dummy
[dummy] Was reinitialized, rate=48000Hz, nch = 2, format = 0x00000000  
and bps = 2
[dummy] Was reinitialized, rate=48000Hz, nch = 2, format = 0x00000000  
and bps = 2
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not  
writing vprp header.
LAME version 3.97 (alpha 1, May  8 2004 01:41:42)  
(http://www.mp3dev.org/)
warning: alpha versions should be used for testing only
Using polyphase lowpass filter, transition band: 17226 Hz - 17806 Hz

[snip]

Pos:3553.1s 104637f (98%)  24fps Trem:   0min 394mb  A-V:0.010  
[785:128] A/Vms 2/37 D/B/S 2091/242/241
demux_mpg: 30fps NTSC content detected, switching framerate.
Warning! FPS changed 23.976 -> 29.970  (-5.994000) [4]  :0.014  
[785:128] A/Vms 2/37 D/B/S 2092/242/241
ty:WARNING - Would have blown my audio buffer 393mb  A-V:0.059  
[784:128] A/Vms 2/36 D/B/S 2092/248/247
Pos:3577.6s 105381f (99%)  25fps Trem:   0min 394mb  A-V:0.031  
[784:128] A/Vms 2/36 D/B/S 2095/256/250
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x0022fa08 in mpeg2_set_buf (mpeg2dec=0x2006c10, buf=0x190aa00,  
id=0x190a9e0) at decode.c:383
383         if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){
(gdb) where
#0  0x0022fa08 in mpeg2_set_buf (mpeg2dec=0x2006c10, buf=0x190aa00,  
id=0x190a9e0) at decode.c:383
#1  0x0022f9a0 in mpeg2_set_buf (mpeg2dec=0x2006c10, buf=0x190aa00,  
id=0x190a9e0) at decode.c:368
#2  0x0018bcfc in decode (sh=0x1909300, data=0x190aa00, len=33582096,  
flags=480) at vd_libmpeg2.c:147
#3  0x00043364 in decode_video (sh_video=0x1909300, start=0x190aa00  
"\002\200\200", in_size=33582620, drop_frame=0) at dec_video.c:309
#4  0x0000534c in main (argc=26257888, argv=0x2006e1c) at  
mencoder.c:1297
(gdb) l
378         fbuf->buf[0] = buf[0];
379         fbuf->buf[1] = buf[1];
380         fbuf->buf[2] = buf[2];
381         fbuf->id = id;
382         // HACK! FIXME! At first I frame, copy pointers to  
prediction frame too!
383         if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){
384             mpeg2dec->fbuf[1]->buf[0]=buf[0];
385             mpeg2dec->fbuf[1]->buf[1]=buf[1];
386             mpeg2dec->fbuf[1]->buf[2]=buf[2];
387             mpeg2dec->fbuf[1]->id=NULL;
(gdb) p mpeg2dec
$1 = (mpeg2dec_t *) 0x2006c10
(gdb) p mpeg2dec->custom_fbuf
$2 = 1
(gdb) p mpeg2dec->fbuf[1]
$3 = (fbuf_t *) 0x0


Third issue: if I use '-endpos 30' to get a preview .avi file, and then  
load it into virtualDub (on my PC), I get complaints about not being  
able to load a decompressor for the audio format.  Is this normal given  
the options I used?

Thanks in advance,
Mark




More information about the MPlayer-users mailing list