Hi, I've been working on a problem for quite a few days now, trying to track
down why the MpegEncContext does not contain the correct information when it
come to encode some mpeg2 video and ultimately wrap it to a mov.

I'm setting up an AVFormatContext and and AVStream within that to contain my
codec context, all which appear to be correct.

When I run in gdb, it crashes at  libavcodec/mpegvideo_enc.c:1194 in the
MPV_encode_picture function as it tries to divide s->mb_height by 0.
In addition to mb_height being 0, mb_width, height and width are all zero.

When I don't use AVFormatContext or AVStream and directly allocate an
AVFormatContext and write out to a .m2v file, it works perfectly, with
mb_height etc all being set correctly in the MpegEncContext.

Does anyone know what I could be missing in my alloc of the various structs?

Here is the gdb output:

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7ffff1dc6950 (LWP 2612)]
0x0000000000680cee in MPV_encode_picture (avctx=0x119d0c0,
buf=0x7ffff0d1a010 "", buf_size=<value optimized out>,
    data=0x11b3420) at libavcodec/mpegvideo_enc.c:1194
1194    libavcodec/mpegvideo_enc.c: No such file or directory.
        in libavcodec/mpegvideo_enc.c
Current language:  auto; currently c
(gdb) backtrace
#0  0x0000000000680cee in MPV_encode_picture (avctx=0x119d0c0,
buf=0x7ffff0d1a010 "", buf_size=<value optimized out>,
    data=0x11b3420) at libavcodec/mpegvideo_enc.c:1194
#1  0x00000000006369db in avcodec_encode_video (avctx=0x119d0c0,
buf=0x7ffff0d1a010 "", buf_size=0, pict=0x0)
    at libavcodec/utils.c:495
#2  0x00000000005a200f in ffmpeg_encoder_av_encode_video (in_enc=0x119b9a0,
    p_video=0x7fffdda68000 "\220\217\217\217\"...) at
ffmpeg_encoder_av.c:678
#3  0x00000000004aa4ba in start_record_thread (p_arg=<value optimized out>)
at recorder_functions.cpp:1421
#4  0x00007ffff54b0070 in start_thread () from /lib64/libpthread.so.0
#5  0x00007ffff48a010d in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()
(gdb) print s->mb_height
$1 = 0
(gdb) print s->height
$2 = 0
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to