JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
125 stars 53 forks source link

Playback issues with videos encoded with `AV_PIX_FMT_GRAY8` when playback is done with Nvidia hardware acceleration on linux #324

Open galenlynch opened 3 years ago

galenlynch commented 3 years ago

The default transfer and target format is AV_PIX_FMT_GRAY8 if the user supplies Gray, Unsigned, or FixedPoint arrays. However, I have run into problems playing these videos on linux when the video player is using nvdec hardware acceleration, it looks badly corrupted, particularly its chroma. These videos seem to be fine with software decoders, or on Windows with either hardware or software decoders. I don't know if the (non-existent?) chroma is being handled incorrectly in our package and some metadata in the container allows some decoders to ignore the chroma or what.

In these cases using RGB arrays to feed the VideoIO encoder circumvents this issue.

It makes me question whether we should be using AV_PIX_FMT_GRAY8 as the encoded pixel format.

IanButterworth commented 3 years ago

Yeah, I've turned off h264 hardware decoding in VLC because of this. I just assumed their hardware decoders were not fully compliant with the standard.

If the user's objective is to maintain lossless data with the best compression AV_PIX_FMT_GRAY8 may still be the best choice, even if players struggle. For some users, the videos playing back reliably across all video players isn't a high priority requirement.