[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
demuxer.
maybe Tomas has an idea..
I notice that there was some code submitted
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=7d531e83b6b64e49931d31989b8cf9074bc22432

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
acket|codec_type=video|stream_index=0|pts=N/A|pts_time=N/A|dts=0|dts_time=0.000|duration=1|duration_time=0.040|size=412615|pos=13312|flags=K
packet|codec_type=video|stream_index=0|pts=N/A|pts_time=N/A|dts=1|dts_time=0.040|duration=1|duration_time=0.040|size=274785|pos=476672|flags=_
packet|codec_type=video|stream_index=0|pts=2|pts_time=0.080|dts=2|dts_time=0.080|duration=1|duration_time=0.040|size=202784|pos=802816|flags=_
packet|codec_type=video|stream_index=0|pts=3|pts_time=0.120|dts=3|dts_time=0.120|duration=1|duration_time=0.040|size=302117|pos=1057280|flags=_
packet|codec_type=video|stream_index=0|pts=N/A|pts_time=N/A|dts=4|dts_time=0.160|duration=1|duration_time=0.040|size=500000|pos=1410048|flags=_
packet|codec_type=video|stream_index=0|pts=5|pts_time=0.200|dts=5|dts_time=0.200|duration=1|duration_time=0.040|size=250001|pos=1961472|flags=_
packet|codec_type=video|stream_index=0|pts=N/A|pts_time=N/A|dts=6|dts_time=0.240|duration=1|duration_time=0.040|size=438608|pos=2263040|flags=K
packet|codec_type=video|stream_index=0|pts=N/A|pts_time=N/A|dts=7|dts_time=0.280|duration=1|duration_time=0.040|size=264032|pos=2753024|flags=_
packet|codec_type=video|stream_index=0|pts=8|pts_time=0.320|dts=8|dts_time=0.320|duration=1|duration_time=0.040|size=172725|pos=3066880|flags=_
packet|codec_type=video|stream_index=0|pts=9|pts_time=0.360|dts=9|dts_time=0.360|duration=1|duration_time=0.040|size=194343|pos=3290624|flags=_
packet|codec_type=video|stream_index=0|pts=N/A|pts_time=N/A|dts=10|dts_time=0.400|duration=1|duration_time=0.040|size=270395|pos=3534848|flags=_


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 ...
>
>
true.
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