2015-02-26 23:46 GMT+00:00 Michael Niedermayer <michae...@gmx.at>: > On Thu, Feb 26, 2015 at 05:26:36PM +0000, Eng. Tweellt wrote: > > Hello everyone, > > > > I'm trying to encode video and audio directly from a capture board, 1 > video > > stream and 8 single channel audio streams into a MXF file encoding it in > > Mpeg-2. > > > > Everything is working fine except when I call av_write_trailer() at the > end > > (and before freeing CodecContext as stated in the documentation). > > > > After using av_write_trailer, I end up with the whole video looking like > > this http://i.imgur.com/M6HkcpR.jpg . It seems like the decoder is > > misplacing the b-frames in the wrong position, but If i don't call this > > function I can play the media file, with the image as it should be, in > VLC > > but the timestamp is completely wrong. > > Looking at mediainfo I can see that my file doesn't have the file > duration > > (which later made sense when I looked inside the code.) > > > > After a few hours with the file mxfenc.c found that if I comment the > next > > part inside the function mxf_write_footer(), the write trailer "kinda" > > works, > > > > (...) > > if (mxf->edit_unit_byte_count && s->oformat != &ff_mxf_opatom_muxer) { // > > no need to repeat index > > if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, > 0)) < > > 0) > > return err; > > } /*else { > > if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, > 0)) < > > 0) > > return err; > > mxf_write_klv_fill(s); > > mxf_write_index_table_segment(s); > > }*/ > > (...) > > > > The "kinda" works part, its because I can play the file correctly in VLC > > with the correct timestamps, and if I open it with Mediainfo everything > > looks good, but If I try to open it with Sorenson Squeeze (for example), > I > > get a warning saying "Squeeze does not support playing this file". > > I carefully followed the documentation, samples, examples and I'm still > > stuck :S. > > I am using the ffmpeg 2.5.1 version and I also added a few changes that I > > saw in the master, and nothing changed. > > > > Additional info: > > > > Target Output file format is a 1080i59.94, XDCam 30Mbit MXF op1a. > > > > Regarding the 8 audio streams the codec options have the one provided by > > avcodec_get_context_defaults3 plus this changes: > > > > audio_codec_context->channels=1; > > audio_codec_context->sample_rate = 48000; > > audio_codec_context->bit_rate = 768000; > > audio_codec_context->sample_fmt =AV_SAMPLE_FMT_S16; > > audio_codec_context->flags= CODEC_FLAG_GLOBAL_HEADER; > > audio_codec_context->time_base->num = 48000; > > > > > > Regarding video I also do avcodec_get_context_defaults3 plus this: > > > > video_codec_context-> pix_fmt= AV_PIX_FMT_YUV422P; > > video_codec_context->height = 1080; > > video_codec_context->time_base->den = 30000; > > video_codec_context->time_base->num = 1001; > > video_codec_context->field_order= AVFieldOrder.AV_FIELD_TB; > > video_codec_context->width = 1920; > > video_codec_context->codec_id= AV_CODEC_ID_MPEG2VIDEO; > > video_codec_context->has_b_frames= 1; > > video_codec_context->max_b_frames = 2; > > video_codec_context->gop_size= 12; > > video_codec_context->global_quality= FF_QP2LAMBDA * 1; > > video_codec_context->rc_initial_buffer_occupancy= 10695476; > > video_codec_context->scenechange_threshold = 1000000000; > > video_codec_context->color_primaries= AVCOL_PRI_BT709; > > video_codec_context->color_trc= AVCOL_TRC_BT709; > > video_codec_context->qmin= 1; > > video_codec_context->flags |= CODEC_FLAG_GLOBAL_HEADER | > > CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME; > > video_codec_context->bit_rate = 30000000; > > video_codec_context->rc_min_rate= 30000000; > > video_codec_context->rc_max_rate= 30000000; > > video_codec_context->rc_buffer_size= 10695476; > > > > > > I also had specified me_method and me_range, but nothing changed. > > > > Any idea what might be the problem? > > can the problem be reproduced with command line FFmpeg ? > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > While the State exists there can be no freedom; when there is freedom there > will be no State. -- Vladimir Lenin >
Hi Michael, I can't really tell. Encoding from another file seams to work fine but encoding from a live source it does not. Now there are some differences, for instance when getting frames from a live source I have to deal with PTS values, duration and so on. Is there a way to encode directly from a live source using command line? Cheers _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel