Opened 13 years ago

Closed 13 years ago

#1943 closed defect (fixed)

regression in mencoder encoding from mp4 to flv

Reported by: compn Owned by: reimar
Priority: normal Component: mencoder
Version: HEAD Severity: normal
Keywords: Cc: ikalvachev@…
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

/usr/local/bin/mencoder /home/redtv69/public_html/media/videos/vid/3.flv -o /home/redtv69/public_html/media/videos/flv/3_temp.flv -ovc lavc -lavcopts vcodec=flv:vbitrate=600:mbd=2:mv0:trell:v4mv:keyint=192:cbp:last_pred=3:predia=4:dia=4:preme=2:vmax_b_frames=0:vb_strategy=1 -of lavf -oac mp3lame -lameopts abr:br=128 -srate 44100 -ofps 24.000 -vf harddup -demuxer mov 2>&1

Output:
MEncoder SVN-r33720-4.1.2 (C) 2000-2011 MPlayer Team
get_path("config") problem
success: format: 0 data: 0x0 - 0x2bc83d9
Quicktime/MOV file format detected.
[mov] Video stream found, -vid 0
[mov] Audio stream found, -aid 1
VIDEO: [avc1] 480x352 24bpp 24.000 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:7 fourcc:0x31637661 size:480x352 fps:24.000 ftime:=0.0417
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 22500 Hz, 2 ch, s16le, 720.0 kbit/100.00% (ratio: 90000->90000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
MUXER_LAVF *
REMEMBER: MEncoder's libavformat muxing is presently broken and can 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.
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
MP3 audio selected.
Unsupported PixelFormat 61
Unsupported PixelFormat 53
[h264 @ 0xc6bb20]Missing reference picture
Pos: 0.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]

1 duplicate frame(s)!
VIDEO CODEC ID: 22
AUDIO CODEC ID: 15001, TAG: 0
Writing header...
[flv @ 0xbf1da0]dimensions not set

Change History (3)

comment:1 by compn, 13 years ago

smaller command line:

F:\mplayer-test>mencode 10.mp4 -o output.flv -ovc lavc -nosound
MEncoder SVN-r33713-4.2.4 (C) 2000-2011 MPlayer Team
161 audio & 354 video codecs

WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.
success: format: 0 data: 0x0 - 0x0
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO: [H264] 480x352 24bpp 24.000 fps 601.2 kbps (73.4 kbyte/s)

it just ends there.

here is output of older mencoder where it works.

F:\mplayer-test>mencoder 10.mp4 -o output.flv -ovc lavc -nosound
MEncoder Sherpya-SVN-r32492-4.2.5 (C) 2000-2010 MPlayer Team
161 audio & 354 video codecs

WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.
success: format: 0 data: 0x0 - 0x2bc83d9
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO: [H264] 480x352 24bpp 24.000 fps 601.2 kbps (73.4 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:480x352 fps:24.000 ftime:=0.0417
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Pos: 0.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]

1 duplicate frame(s)!
Muxer frame buffer cannot allocate memory!
Pos: 0.0s 2f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
Movie-Aspect is undefined - no prescaling applied.
videocodec: libavcodec (480x352 fourcc=34504d46 [FMP4])
Fontconfig error: Cannot load default config file
Fontconfig failed to select a font. Trying without fontconfig...
Fontconfig failed to select a font. Trying without fontconfig...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

1 duplicate frame(s)!
Pos: 3.2s 77f ( 1%) 51.47fps Trem: 2min 34mb A-V:0.000 [957:0]]

Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

Video stream: 957.385 kbit/s (119673 B/s) size: 378965 bytes 3.167 secs 77 frames

happens with -demuxer mov and -demuxer lavf

comment:2 by ikalvachev@…, 13 years ago

Cc: ikalvachev@… added

I dig the bug a little bit.
The problem is that file headers is written before encoder gets its config(). Thus the dimensions are not yet known.

I put assert(0); in the block that prints the "[flv @ 0xbf1da0]dimensions not set" and got the following backtrace:

#0 0xb73691d7 in raise () from /lib/libc.so.6
#1 0xb736abee in abort () from /lib/libc.so.6
#2 0xb7361b97 in assert_fail () from /lib/libc.so.6
#3 0x082f5619 in avformat_write_header (s=0x8fe8730, options=0x0) at utils.c:2943
#4 0x082f5979 in av_write_header (s=0x8fe8730) at utils.c:2898
#5 0x080cb41b in write_header (muxer=0x8feada0) at libmpdemux/muxer_lavf.c:288
#6 0x080bf78e in muxer_flush (m=0x8feada0) at libmpdemux/muxer.c:92
#7 0x080bfa80 in muxer_write_chunk (s=0x8feae80, len=0, flags=0, dts=<value optimized out>, pts=<value optimized out>) at libmpdemux/muxer.c:167
#8 0x080b9e05 in main (argc=Cannot access memory at address 0x5e39
) at mencoder.c:1520

--- mencoder.c (revision 33634)
+++ mencoder.c (working copy)
@@ -1517,7 +1517,7 @@

while(skip_flag<0){

duplicatedframes++;

if (!encode_duplicates
!sh_video->vfilter ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
  • muxer_write_chunk(mux_v,0,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);

+ muxer_write_chunk(mux_v,0,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);

++skip_flag;

}

} else

The option "-encodedup" seems to prevent the crash.

comment:3 by ikalvachev@…, 13 years ago

Resolution: fixed
Status: newclosed

Commit r33733 by Tobias Diedrich (ranma) should fix this bug. Please test.

Note: See TracTickets for help on using tickets.