[FFmpeg-devel] DVCPRO HD: request for review

Roman V. Shaposhnik rvs
Tue Aug 26 18:14:12 CEST 2008

Hi Thomas!

On Tue, 2008-08-26 at 10:15 +0200, Thomas Parmegiani wrote:
> > I'm not quite sure I understand what you mean by "old code" and "given
> > code". The current patch aims at decoding 720p as a stream of normal
> > frames. Even though each DV frame has two of them. If you have practical
> > examples of where that fails for you -- please make the sample
> > available.
> "Old code" is the code provided by Dan Maas.
> "Given code" is using the patch you provided.
> For example, if I try to transcode a 720p60 which has 400 frames. After 
> applied your patch and using the following command line :
> ffmpeg -i /D/720p60.mxf -an /D/result.ts.
> I get a TS file which has 200 frames instead of 400. So I think you 
> don't manage all the frames (one of two).
> In libavcodec/dv.c in dv_decode_video_frame() function the amount of dv 
> data passed as argument is 480000 (2 x 240 000) which is 2 x DV encoded 
> frame size (according to DV Profile in dvdata.h).
> The problem is that when I try to play result.ts file it plays at x2 
> speed like if the frame rate was 29.97 instead of 59.94.
> I hope my explanation was enough clear for you.

It is perfectly clear. And let me tell you why that happens. The .mxf
container does a very stupid thing as far as DVCPRO HD 720p is
concerned. Unlike .mov which packages individual frames (240000) into
individual packets, .mxf appears to be braindead in how it follows
the DV spec. And yes, blindly following the spec is NOT a good thing ;-)
So, in order to prove my hypothesis to you, here's what you should 
do -- extract the raw DV from your .mxf container:
   $ ffmpeg -i your_file.mxf -vcodec copy -f rawvideo -an good.dv
try to convert the resulting good.dv into something meanigful
   $ ffmpeg -i good.dv good.ts
and observe the right # of frames at FPS of 59.94.

Now, this is not to say that we shouldn't workaround the situation
somehow, but I have to think about it. The frames are supposed
to be split some place in the demuxer, but where? I don't know...

Speaking of which, any suggestion would be highly appreciated.

> I provided a sample file into the incoming folder in a folder named 
> 720p60_DVCProHD_problem. Sorry if the file is big (60MB) and zipped but 
> it is the only one I have.
> Please let me know if you want I upload the sample to another area.

That's totally fine. Thank you!


P.S. In fact, with a bit of bash magic, you can actually do everything
in one pass and not trash your HDD with intermediate good.dv:
   $ ffmpeg -f dv -i <(ffmpeg -v 0 -i your_file.mxf -an -vcodec copy -f rawvideo -an - 2>/dev/null) good.ts

More information about the ffmpeg-devel mailing list