slhck / ffmpeg-debug-qp

FFmpeg Debug Script for QP Values
Other
75 stars 24 forks source link

BUG: "frame_type:" message in the middle of a line #8

Closed lars18th closed 4 years ago

lars18th commented 4 years ago

Hi,

I'm using the Windows precompiled version. Almost in that version when a new message "frame_type:" appears it is printed in the middle of the quantization values.

Example:

[mpeg2video @ 00000000005e6580] 222222222222222222222222222222222222282828282828282828282828282828282828282828282828282828
[mpeg2video @ 00000000005e6580] 222222222222222222222222222222222222282828282828282828282828282828282828282828282828282828
[mpeg2video @ 000000000frame_type: B; pkt_size: 2255
05e6580] 222222222222222222222222222222222224282222222222222222222222222222222222222222222222222222
[mpeg2video @ 00000000005e6580] 222222222222222222222222222222222228282828282828282828282828282828282828282828282828282828
[mpeg2video @ 00000000005e6580] 222222222222222222222222222222222222222224222224282228282828282828282828282828282828282828

It appears with MPEG-2 and H.264. I hope you can fix it. Regards.

slhck commented 4 years ago

Interesting obseravtion. I have never tested the Windows version, but I suspect it may have to do with threading. The frame types are logged from the main application, while the debug values are printed by the ffmpeg libraries.

@plebreton Do you have an idea why this would happen?

plebreton commented 4 years ago

Hi,

Yes, I will have a look. Not sure if I can do it tonight though (it is the end of the day in my time zone).

I will see what I can do. Tomorrow at worst.

plebreton commented 4 years ago

Just a small update on this. I have been able to reproduce the problem, but I haven't solved it yet

lars18th commented 4 years ago

Hi, any news about this trouble?

lars18th commented 4 years ago

Hi @slhck ,

Please check my solution #19 .

lars18th commented 4 years ago

Hi,

After testing the CI build of the Windows version, the problem continues in Windows:

[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010
[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010
[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010
[mpeg2video @ 0000000000588080] 101010101010101010101010101010101010101010101010101010<< frame_type: P; pkt_size: 10780 >>
10101010101010
[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010
[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010
[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010
[mpeg2video @ 0000000000588080] 10101010101010101010101010101010101010101010101010101010101010101010

But, with the new format the parsing can be overcomed in the python parser. I'll try to provide a PR that "replaces" the << frame_type: ... >>\n with the next line. Using this way the parsing will provide the same results.

Regards.

slhck commented 4 years ago

Please wait a day before providing a PR, as I am about to restructure the tool into a proper Python package. I will be done with this tomorrow! Then your changes will be based on the latest version.

lars18th commented 4 years ago

Updated PR #24 to fix it.

lars18th commented 4 years ago

Hi @slhck ,

I confirm that in Windows using the last ci pre-compiled binary this problem has gone. :tada: So I close the issue.

However, please @slhck check to increase the number of threads: https://github.com/slhck/ffmpeg-debug-qp/blob/master/ffmpeg_debug_qp.c#L225 The tool is now thread-safe and the number can be increased without disturbing results. I recommend to use '3' threads.

Regards.