[FFmpeg-user] Stream copy of mxf format is weird

Syehoon Kim gregfeynman at gmail.com
Tue Jan 30 12:02:21 EET 2024


2024년 1월 30일 (화) 오후 6:28, Nicolas Gaullier <nicolas.gaullier at cji.paris>님이 작성:
>
> >De : ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> De la part de Syehoon Kim
> >(...)
> >But, I found that the new stream copied mxf file suffers from non-monotonous dts problem.
> >What I found is that dts is duplicated every 3 frames.
> >
> >The command I used is as follows:
> >  ffmpeg -i (original_mxf).mxf -codec copy (stream_copied).mxf Interestingly, if I convert the weird mxf output file to another format such as mov, or avi, it works well.
>
> It is not very clear to me, but it seems you only inspected the output and not the input.
> To start with, here is something you can try to quickly check dts/pts of your mxf input:
> ffmpeg -I input.mxf  -map v -c copy -f framecrc -
> You can also directly decode to void to check some non-monotonous errors: ffmpeg -i input.mxf -f null null
> You can also play your input file with mpv keeping an eye on the console output messages.
> You can also dump your input mxf structure with dedicated tools (bmx, mxflib).
> It is not very widespread or well-known, but timestamp issues DO happen in the mxf wrapper itself.

Dear Nicolas, Thank you for responding.
mpv says the output file has wrong dts like below:
Invalid video timestamp: 0.066733 -> 0.000000
AV: 00:00:00 / 00:00:31 (0%) A-V:  0.069
Invalid video timestamp: 0.166833 -> 0.100100
AV: 00:00:00 / 00:00:31 (1%) A-V:  0.119
Invalid video timestamp: 0.266933 -> 0.200200
AV: 00:00:00 / 00:00:31 (1%) A-V:  0.169
Invalid video timestamp: 0.367033 -> 0.300300
AV: 00:00:00 / 00:00:31 (1%) A-V:  0.219
Invalid video timestamp: 0.467133 -> 0.400400
AV: 00:00:00 / 00:00:31 (2%) A-V:  0.269 ct:  0.065
Invalid video timestamp: 0.567233 -> 0.500500
AV: 00:00:00 / 00:00:31 (2%) A-V:  0.289 ct:  0.112

Whilst with input file, there is no problem.(No message)
And also I checked ffmpeg -i original.mxf -f framecrc, and it says
0,          0,          0,        1,  8294400, 0x56b7a44f
1,          0,          0,     1602,     3204, 0x3aa6ef88
0,          1,          1,        1,  8294400, 0x2398a5bd
1,       1602,       1602,     1601,     3202, 0xefa05a78
1,       3203,       3203,     1602,     3204, 0x38666a9f
0,          2,          2,        1,  8294400, 0x7993d275
0,          3,          3,        1,  8294400, 0xb12c0e14
1,       4805,       4805,     1601,     3202, 0xee903064
1,       6406,       6406,     1602,     3204, 0xd3624831
0,          4,          4,        1,  8294400, 0x9f309f83
0,          5,          5,        1,  8294400, 0x13e0a483
1,       8008,       8008,     1602,     3204, 0x13ca68e6
0,          6,          6,        1,  8294400, 0x7202ffa7
1,       9610,       9610,     1601,     3202, 0x30fa7edc
1,      11211,      11211,     1602,     3204, 0xcf8654dd
0,          7,          7,        1,  8294400, 0xf7c8a639
0,          8,          8,        1,  8294400, 0x9a581134
1,      12813,      12813,     1601,     3202, 0x13fd730a
1,      14414,      14414,     1602,     3204, 0x1a733eb1
0,          9,          9,        1,  8294400, 0x9adaf21b
0,         10,         10,        1,  8294400, 0x647034b3
1,      16016,      16016,     1602,     3204, 0xbdf95fa5
0,         11,         11,        1,  8294400, 0x0bc80cf3
1,      17618,      17618,     1601,     3202, 0x40d40c11
1,      19219,      19219,     1602,     3204, 0x1565256b
0,         12,         12,        1,  8294400, 0xb6a2cb17

Which seems fine with packet_dts.
But, ffmpeg -i output.mxf -f framesrc says
1,          0,          0,     1602,     3204, 0x3aa6ef88
0,          1,          1,        1,  8294400, 0x56b7a44f
1,       1602,       1602,     1601,     3202, 0xefa05a78
1,       3203,       3203,     1602,     3204, 0x38666a9f
0,          2,          2,        1,  8294400, 0x2398a5bd
1,       4805,       4805,     1601,     3202, 0xee903064
1,       6406,       6406,     1602,     3204, 0xd3624831
0,          4,          4,        1,  8294400, 0xb12c0e14
0,          5,          5,        1,  8294400, 0x9f309f83
1,       8008,       8008,     1602,     3204, 0x13ca68e6
1,       9610,       9610,     1601,     3202, 0x30fa7edc
1,      11211,      11211,     1602,     3204, 0xcf8654dd
0,          7,          7,        1,  8294400, 0x7202ffa7
0,          8,          8,        1,  8294400, 0xf7c8a639
1,      12813,      12813,     1601,     3202, 0x13fd730a
1,      14414,      14414,     1602,     3204, 0x1a733eb1
0,         10,         10,        1,  8294400, 0x9adaf21b
1,      16016,      16016,     1602,     3204, 0xbdf95fa5
0,         11,         11,        1,  8294400, 0x647034b3
1,      17618,      17618,     1601,     3202, 0x40d40c11
1,      19219,      19219,     1602,     3204, 0x1565256b
0,         13,         13,        1,  8294400, 0xb6a2cb17
1,      20821,      20821,     1601,     3202, 0x2be40b71
1,      22422,      22422,     1602,     3204, 0x2e7f26be
0,         14,         14,        1,  8294400, 0x85a41143
1,      24024,      24024,     1602,     3204, 0xa74d1c7b50 bitrate=
26.9kbits/s dup=0 drop=5 speed=0.984x
0,         16,         16,        1,  8294400, 0x94964a0b
Definitely, there is no packet_dts=3,6,9,... and there are 5 frame drops.

I think there is nothing wrong with the original input file.
Like you said, maybe it is due to the defect of the mxf wrapper.
Thank you for notifying about mxf wrapper's timestamp issue.
Sincerely,
Kim Syehoon


More information about the ffmpeg-user mailing list