I’m developing hardware accelerated transcoding software, which handles multicast live streams. I’ve found during a test, that decoder produces out of order pictures on some streams. I’ve dump timestamps and raw output frames to check if this is my bug with timestamps or something.
Timestamps are correct but pics aren’t. The decoder produces a frame that should be shown 10 seconds ago or so, but with the current timestamp. You can see them in output.ts at 0:18, 0:29, 0:59, 1:30, 2:00, 2:10, 2:21, 2:37. For verification, I’ve ran this stream through the FFmpeg with the same result. You can find input and output streams here: https://yadi.sk/d/pKQ-waO2N-tNFw Configurations on which I’ve checked for this issue:
The reason behind the problems is that sometimes CUVIDPARSERDISPINFO has property progressive_frame equal to 1 (which is wrong when videos are interlaced). In order to fix the problem we should check if the video is interlaced or progressive in the beginning of a video sequence (the best place for that is cuvid_handle_video_sequence function). And then we just use this information instead of the faulty progressive_frame in CUVIDPARSERDISPINFO.
Your solution do the trick. Really appreciate your work.
About dropping of the second field:
It reduces the loading of NVENC and allows you to transcode more channels per one card. 50 fps are good for sports but aren’t always necessary for cinema.
This ffmpeg command is just a showcase, but thank you for your additions about the params. :)