Open Amsitram opened 4 days ago
Was this encountered with a Mac that has an Intel chip, or one with an Apple Silicon chip?
Apple Silicon chip.
Excellent clear report.
As hardware decoding is chip dependent often it works on one and not the other. I've not tested on my M1 yet. I'm currently using my Intel Mac and it reproduced for me, so both architectures exhibit problems. After taking a closer look I can explain why.
For audio/video playback support IINA uses a library from the mpv project. Certain types of video problems involve IINA code, but this problem is outside of IINA's code base and in the libraries IINA uses. Worse, as you indicated and I have confirmed, this problem still occurs with the development version of IINA which uses upgraded dependencies.
The failure is exactly as you described. Something goes wrong after seeking, hardware acceleration fails and decoding falls back to software as seen in the following clip from the mpv log.
I'm also seeing malformed thumbnails when hovering over the OSC. That is related to the problem at hand.
The problem extends beyond hardware decoding. If you disable hardware decoding there are still problems.
The video file uses a BDAV MPEG transport stream container file format. There are known problems with mpv and FFmpeg when seeking in a .m2ts
file. See IINA issue #4785. That issue explains why the OSC thumbnails are malformed as IINA is seeking using FFmpeg to capture those thumbnails.
There is a lot of discussion about this in mpv issues. Many were closed citing the limitations of the MPEG-TS format and recommending remuxing the file into MP4 or Matroska if the ability to seek is needed.
For #4785, instead of reporting this problem to mpv as a bug, I entered a feature request asking for improved MPEG-TS seeking, pointing out that VLC is doing something to overcome the limitations of the MPEG-TS encoding. See the mpv issue https://github.com/mpv-player/mpv/issues/13345. As per the latest comment on #4785 the FFmpeg ticket #9412 is part of the problem.
It is likely these mpv and FFmpeg issues are not getting attention because people use the workaround of remuxing.
Unfortunately IINA has to wait for the upstream projects to provide better support for MPEG-TS encoded files.
Thank you so much for taking the time to analyze this and for responding in such detail. Thanks to your report, I understand that the source of the problem lies in the limitations of m2ts format support by the ffmpeg libraries and therefore of mpv and iina. As a result, the problem is probably not directly linked to the HDR nature of the video.
Since you've already made the feature request, all that's left is to wait and hope.
Thanks again for your help :)
When I have time I try and explain my analysis in detail. This allows people to confirm my understanding of what they are reporting is correct and to point out any mistakes in my analysis. Your understanding is correct, the problem is not related to HDR.
I had a chance today to try remuxing as mpv suggests. I used FFmpeg to copy the streams into a Matroska file:
ffmpeg -i 00002.m2ts -c copy -map 0 00002.mkv
When playing the resulting .mkv
file with IINA 1.3.5:
However, with the development version of IINA I'm seeing these errors from FFmpeg when seeking:
[ 78.148][e][ffmpeg/video] hevc: First slice in a frame missing.
From a quick investigation this is looking like a FFmpeg regression. I need to investigate more and confirm that. This did not seem to disrupt playback, but regressions are concerning.
I noticed in the posted screen capture video that IINA's inspector window failed to update to show that hardware decoding was no longer being used. I consider that a defect. I have posted PR #5283 with a fix for that. The fix will need to be reviewed, but it should make it into the next release of IINA. Very helpful that you posted that screen capture.
IINA Version
1.3.5
Release Channel
Release
macOS Version
15.1.1
Steps to Reproduce
Expected Behavior
The pixel format should remain the same.
Actual Behavior
The pixel format changes and seems no longer hardware accelerated, which causes lags.
https://github.com/user-attachments/assets/7c7bb7ff-96d5-4c26-9fc5-e5966ed1280a
Crash Report or Process Sample
No response
Logs
No response
Sample Files
https://drive.google.com/uc?id=1bQvSl89OX0rStQLgBc60_6mNCJichMk6
How often can you reproduce the issue
Always.
Required Actions
Optional Actions