[MEncoder-users] [Patch] Division-by-zero problem caused by 'dimensionnot set' (Was: Same file, diff outputs)

Jiang Hong netex at 163.com
Wed Jun 28 07:09:00 CEST 2006


Hi,

The file is partially corrupted. So av_frac_add will be called with a AVFrac
of {0,0,0} (den=0). So:

--- d:/try/mplayer/libavformat/utils.c	Mon Jun 26 12:20:58 2006
+++ utils.c	Wed Jun 28 13:02:06 2006

@@ -2367,6 +2368,8 @@

  //    av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts2:%lld dts2:%lld\n", pkt->pts, pkt->dts);
     st->cur_dts= pkt->dts;
     st->pts.val= pkt->dts;
+    st->pts.num= 0;
+    st->pts.den= 1;
 
     /* update pts */
     switch (st->codec->codec_type) {

@@ -3178,12 +3181,15 @@

  * @param f fractional number
  * @param incr increment, can be positive or negative
  */
 {
     int64_t num, den;
 
     num = f->num + incr;
     den = f->den;
+
+    if (den == 0) den = 1;
+
     if (num < 0) {
         f->val += num / den;
         num = num % den;


> 
> 
> Hi,
> 
> $ mencoder -vf scale=384:288 -ffourcc FLV1 -of lavf -lavfopts i_certify_tha
> t_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=
> 200000:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:precmp=2:cmp=2:subcmp
> =2:preme=2:turbo -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=48 -ofps 1
> 5 -o 1.flv -v 10426.avi
> 
> MEncoder dev-SVN-r-3.4.2 (C) 2000-2006 MPlayer Team
> CPU: Genuine Intel(R) CPU           T2400  @ 1.83GHz (Family: 6, Model: 14, Step
> ping: 8)
> CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
> Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
> 
> init_freetype
> get_path('font/font.desc') -> 'C:/xxx/mplayer/font/font.desc'
> font: can't open file: C:/xxx/mplayer/font/font.desc
> font: can't open file: /usr/local/share/mplayer/font/font.desc
> Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
> WINSOCK2 init: 0
> [file] File size is 43718126 bytes
> STREAM: [file] 10426.avi
> STREAM: Description: File
> STREAM: Author: Albeu
> STREAM: Comment: based on the code from ??? (probably Arpi)
> success: format: 0  data: 0x0 - 0x29b15ee
> AVI file format detected.
> list_end=0x1E4
> ======= AVI Header =======
> us/frame: 80000  (fps=12.500)
> max bytes/sec: 2196480
> padding: 1
> MainAVIHeader.dwFlags: (2048) TRUST_CKTYPE
> frames  total: 32004   initial: 0
> streams: 2
> Suggested BufferSize: 9230
> Size:  208 x 176
> ==========================
> list_end=0x138
> ==> Found video stream: 0
> ====== STREAM Header =====
> Type: vids   FCC: XVID (44495658)
> Flags: 0
> Priority: 0   Language: 0
> InitialFrames: 0
> Rate: 10000000/800000 = 12.500
> Start: 0   Len: 32004
> Suggested BufferSize: 9230
> Quality 0
> Sample size: 0
> ==========================
> Found 'bih', 44 bytes of 40
> ======= VIDEO Format ======
>   biSize 40
>   biWidth 208
>   biHeight 176
>   biPlanes 1
>   biBitCount 24
>   biCompression 1145656920='XVID'
>   biSizeImage 109824
> ===========================
> Regenerating keyframe table for MPEG-4 video.
> ====== AVI Super Index Header ========
>   FCC (indx) dwSize (40) wLongsPerEntry(4)
>   bIndexSubType (0) bIndexType (0)
>   nEntriesInUse (1) dwChunkId (00db)
>   dwReserved[0] (0) dwReserved[1] (0) dwReserved[2] (0)
> ===========================
> ODML (00db): [0] 0x000000000296dd86 0x3e840 32004
> list_end=0x1E4
> ==> Found audio stream: 1
> ====== STREAM Header =====
> Type: auds   FCC:  (0)
> Flags: 0
> Priority: 0   Language: 0
> InitialFrames: 0
> Rate: 3000/1 = 3000.000
> Start: 0   Len: 7681392
> Suggested BufferSize: 3008
> Quality 0
> Sample size: 1
> ==========================
> Found 'wf', 40 bytes of 18
> ======= WAVE Format =======
> Format Tag: 85 (0x55)
> Channels: 1
> Samplerate: 16000
> avg byte/sec: 3000
> Block align: 1
> bits/sample: 0
> cbSize: 22
> mp3.wID=4
> mp3.fdwFlags=0x5DC0
> mp3.nBlockSize=8
> mp3.nFramesPerBlock=0
> mp3.nCodecDelay=0
> ==========================================================================
> ====== AVI Super Index Header ========
>   FCC (indx) dwSize (40) wLongsPerEntry(4)
>   bIndexSubType (0) bIndexType (0)
>   nEntriesInUse (1) dwChunkId (01wb)
>   dwReserved[0] (0) dwReserved[1] (0) dwReserved[2] (0)
> ===========================
> ODML (01wb): [0] 0x00000000029ac5c6 0x5028 7681392
> list_end=0x29B15EE
> Found movie at 0x1F0 - 0x29B15EE
> AVI: ODML: Building ODML index (2 superindexchunks).
> ====== AVI Standard Index Header ========
>   FCC (ix00) dwSize (256056) wLongsPerEntry(2)
>   bIndexSubType (0) bIndexType (1)
>   nEntriesInUse (32004) dwChunkId (00db)
>   qwBaseOffset (0x0) dwReserved3 (0)
> ===========================
> ====== AVI Standard Index Header ========
>   FCC (ix01) dwSize (20512) wLongsPerEntry(2)
>   bIndexSubType (0) bIndexType (1)
>   nEntriesInUse (2561) dwChunkId (01wb)
>   qwBaseOffset (0x0) dwReserved3 (0)
> ===========================
> AVI index offset: 0x0 (movi=0x1F0 idx0=0x1F0 idx1=0x88C)
> Auto-selected AVI video ID = 0
> Auto-selected AVI audio ID = 1
> ChunkID mismatch! raw=00dc idx=00db
> AVI: Searching for audio stream (id:1)
> XXX initial  v_pts=0.400  a_pos=0 (0.000)
> AVI video size=35467037 (32004) audio size=7681392 (7681392)
> VIDEO:  [XVID]  208x176  24bpp  12.500 fps  110.8 kbps (13.5 kbyte/s)
> [V] filefmt:3  fourcc:0x44495658  size:208x176  fps:12.50  ftime:=0.0800
> ==========================================================================
> Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
> dec_audio: Allocating 4608 + 65536 = 70144 bytes for output buffer.
> mp3lib: made decode tables with MMX optimization
> mp3lib: using MMX optimized decore!
> MP3lib: init layer2&3 finished, tables done
> MPEG 2.0, Layer III, 16000 Hz 24 kbit Single-Channel, BPF: 108
> Channels: 1, copyright: No, original: No, CRC: No, emphasis: 0
> AUDIO: 16000 Hz, 2 ch, s16le, 24.0 kbit/4.69% (ratio: 3000->64000)
> Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
> ==========================================================================
> ** MUXER_LAVF *****************************************************************
> You have certified that your video stream does not contain B frames.
> REMEMBER: MEncoder's libavformat muxing is presently broken and will generate
> INCORRECT files in the presence of B frames. Moreover, due to bugs MPlayer
> will play these INCORRECT files as if nothing were wrong!
> *******************************************************************************
> OK, exit
> ALLOCATED STREAM N. 1, type=0
> Opening video filter: [expand osd=1]
> Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
> Opening video filter: [scale w=384 h=288]
> SwScale params: 384 x 288 (-1=no scaling)
> ==========================================================================
> Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
> INFO: libavcodec init OK!
> Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
> ==========================================================================
> Forcing output FourCC to 31564c46 [FLV1].
> ALLOCATED STREAM N. 2, type=1
> Building audio filter chain for 16000Hz/2ch/s16le -> 22050Hz/0ch/??...
> [libaf] Adding filter dummy
> [dummy] Was reinitialized: 16000Hz/2ch/s16le
> [libaf] Adding filter lavcresample
> [dummy] Was reinitialized: 22050Hz/2ch/s16le
> [dummy] Was reinitialized: 22050Hz/2ch/s16le
> Building audio filter chain for 16000Hz/2ch/s16le -> 22050Hz/2ch/s16le...
> [dummy] Was reinitialized: 22050Hz/2ch/s16le
> [dummy] Was reinitialized: 22050Hz/2ch/s16le
> [libaf] Reallocating memory in module lavcresample, old len = 0, new len = 2308
> [mpeg4 @ 00B00B48]hmm, seems the headers are not complete, trying to guess time_
> increment_bits
> [mpeg4 @ 00B00B48]my guess is 3 bits ;)
> Pos:   0.0s      1f ( 0%)   0fps Trem:   0min   0mb  A-V:0.000 [0:0] A/Vms 1/8 D
> [mpeg4 @ 00B00B48]hmm, seems the headers are not complete, trying to guess time_
> increment_bits
> [mpeg4 @ 00B00B48]my guess is 2 bits ;)
> 
> 1 duplicate frame(s)!
> Muxer frame buffer sending 21 frame(s) to the muxer.
> VIDEO CODEC ID: 22
> AUDIO CODEC ID: 15001, TAG: 0
> MUXER_LAVF(audio stream) frame_size: 576, scale: 576, sps: 22050, rate: 22050, c
> tx->block_align = stream->wf->nBlockAlign; 0=576 stream->wf->nAvgBytesPerSec:599
> 9
> Writing header...
> [flv @ 00BFDCC4]dimensions not set
> 
> -------
> 
> then mencoder coredumped.
> 
> 
> > 
> > On Tue, Jun 27, 2006 at 05:29:54PM +0200, Nico Sabbi wrote:
> > > Jiang Hong wrote:
> > > >Hi,
> > > >
> > > >It's not a real patch but only a workaround.
> > > >
> > > >  
> > > 
> > > post the full output of mencoder -v ... please
> > 
> > And don't reply into an existing thread for new bug reports/patches!!!
> > 
> > Rich
> > 
> > _______________________________________________
> > MEncoder-users mailing list
> > MEncoder-users at mplayerhq.hu
> > http://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
> 
> 
> -- 
> Jiang Hong <netex at 163.com>
> 
> 
> 
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/mencoder-users


-- 
Jiang Hong <netex at 163.com>






More information about the MEncoder-users mailing list