[FFmpeg-devel] Cannot remux a MXF file to Mpegts

Thierry Foucu tfoucu at gmail.com
Mon Apr 2 06:15:39 CEST 2012

On Sat, Mar 31, 2012 at 12:50 AM, Michael Niedermayer <michaelni at gmx.at>wrote:

> On Fri, Mar 30, 2012 at 08:38:07PM -0700, Thierry Foucu wrote:
> > Hello,
> >
> > When trying to remux a MXF file to Mpeg2Ts and we found out that the
> mpegts
> > muxer require the first frame to have a valid  PTS
> > How ever, the MXF demuxer will set only the DTS for video frame. And so,
> we
> > cannot remux a MXF file to M2TS.
> >
> > You can duplicate the problem by this simple command and using one of
> your
> > fate MXF sample file.
> >
> > ./ffmpeg -i  fate_sample/mxf/C0023S01.mxf -vcodec copy -acodec copy
> >  /tmp/test.ts
> > ....
> > [mpegts @ 0x12be140] first pts value must set
> > av_interleaved_write_frame(): Operation not permitted
> >
> > I'm not sure if this is the right solution, but by applying this change
> > (patch at the end of this email) , we can then remux a MXF file to
> Mpeg2Ts.
> > Or should we fix the MXF demuxer to set a PTS?
> >
> > What do you think if the right approach to fix the problem?
> mpegts needs pts (or something from which pts can be calculated)
> you can use "-fflags +genpts" to force pts calculation but this will
> only work reliably with pre H.264 style codecs. Also genpts will
> introduce a few frames delay.
Thanks..I tried -fflags +genpts and it seems to work. I notice the delay
introduce to it, but it should be fine for our application.
And we are lucky as the video codec is MPEG2

> If posible it would be best if the mxf demuxer could set pts, if there
> is a way to do it, like by using some constant framerate knowledge.
> Iam CC-ing this to our mxf maintainer, he should be able to give us
> a definite awnser if there is sufficient information in the mxf file
> or not to set pts correctly
Agreed. I think it will be best to have the PTS being generated in the MXF
maybe Tomas has an idea..
I notice that there was some code submitted

Was this CL suppose to set the PTS/DTS for video frame?

I checkout a client right after this Patch, and still do not see PTS for
all the frames. Only for B-Frame.
Here is the output of ffprobe

as a 3rd option one could just store something random like done in the
> patch but the mpegts files would then not be standard compliant except
> by pure chance and would likely not play correctly on all players.
> Also i think its better not to create/spread files that arent
> spec compliant ...
With my patch, it seems I'm lucky to make the file compliant, but I agreed,
this is not a correct way.

Tomas, do you have any suggestion?

> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> You can kill me, but you cannot change the truth.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list