I have an app written using ffmpeg-0.6 compiled with libx264 (x264-snapshot-20100308-2245), and I am using the latter to encode video. I copied the settings from the preset file:

<ffmpeg-dir>/share/ffmpeg/libx264-default.ffpreset

The assertion failure message is:

"
Assertion failed: pic_out->i_pts >= pic_out->i_dts, file encoder/encoder.c, line 2484

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
"

It dies after only a few frames. I print out the frame timestamps right before encoding, and they are as follows:

[0x244da8] TRACE LibavVideoMuxer: Frame pts=2961, dts=2961
[0x244da8] TRACE LibavVideoMuxer: Frame pts=3330, dts=3330
[0x244da8] TRACE LibavVideoMuxer: Frame pts=6660, dts=6660
[0x244da8] TRACE LibavVideoMuxer: Frame pts=9090, dts=9090

and then it dies (in avcodec_encode_video()). My frame timestamps obviously don't violate that assertion, so I guess something inside libav* or libx264 is messing them up. If I disable B frames (comment out the max_b_frames setting), then it works ok.

The only libx264 logging output I see before the crash is:

[libx264 @ 014878a0]MB rate (108000000) > level limit (983040)
[libx264 @ 014878a0]using cpu capabilities: none!
[libx264 @ 014878a0]profile High, level 5.1

I also added a log line to the x264 source right before the line where it crashed, to print out the pts and dts in question. It showed:

[libx264 @ 014878a0]pts=-9223372036854775808 dts=0

Looks like garbage.

If I run the 'ffmpeg' tool from the commandline as:

../ffmpeg/bin/ffmpeg -i ../test/s4r3.ts -vcodec libx264 -fpre ../ffmpeg/share/ffmpeg/libx264-default.ffpreset test.flv

that works fine.

The exact codec context setup is pasted below.  Anyone have any ideas?

Andy

    ctx->coder_type = FF_CODER_TYPE_AC; //coder=1
    ctx->flags = CODEC_FLAG_LOOP_FILTER; //flags=+loop
    ctx->me_cmp = FF_CMP_CHROMA; //cmp=+chroma
    ctx->partitions = X264_PART_I4X4 | X264_PART_I8X8 |
X264_PART_P8X8 | X264_PART_B8X8; //partitions=+parti8x8+parti4x4+partp8x8+partb8x8
    ctx->me_method = ME_HEX; //me_method=hex
    ctx->me_subpel_quality = 7; //subq=7
    ctx->me_range = 16;  //me_range=16
    ctx->gop_size = 250; //g=250
    ctx->keyint_min = 25; //keyint_min=25
    ctx->scenechange_threshold = 40; //sc_threshold=40
    ctx->i_quant_factor = 0.71f; //i_qfactor=0.71
    ctx->b_frame_strategy = 1; //b_strategy=1
    ctx->qcompress = 0.6f; //qcomp=0.6
    ctx->qmin = 10; //qmin=10
    ctx->qmax = 51; //qmax=51
    ctx->max_qdiff = 4; //qdiff=4
    ctx->max_b_frames = 3; //bf=3
    ctx->refs = 3; //refs=3
    ctx->directpred = 1; //directpred=1
    ctx->trellis = 1; //trellis=1
    ctx->flags2 = CODEC_FLAG2_MIXED_REFS | CODEC_FLAG2_WPRED |
CODEC_FLAG2_8X8DCT | CODEC_FLAG2_FASTPSKIP; //flags2=+mixed_refs+wpred+dct8x8+fastpskip
    ctx->weighted_p_pred = 2; //wpredp=2

(In case it matters, I also set some other standard properties:)

    ctx->codec_type = AVMEDIA_TYPE_VIDEO;
    ctx->pix_fmt = destPixFmt;
    ctx->time_base = timeBase_;
    ctx->width = destW;
    ctx->height = destH;

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to