iina / iina

The modern video player for macOS.
https://iina.io
GNU General Public License v3.0
38.29k stars 2.57k forks source link

About playback configuration #4283

Open cmdedj opened 1 year ago

cmdedj commented 1 year ago

Can you remember the selection of video tracks, audio tracks and subtitles of the open file? In this way, I don't have to re-select the configuration every time I open it.

cmdedj commented 1 year ago

And subtitle delay

low-batt commented 1 year ago

Start IINA

Similar to many open source projects IINA is layered on top of other projects. For audio/video playback IINA is using a library from the mpv project. Many of the features that can be configured in IINA settings are directly tied to mpv configuration. The name of this IINA setting is very deceptive. This does not just remember the playback position. This setting controls use of the mpv Watch Later feature.

What attributes mpv will save is controlled by the watch-later-options property. IINA uses the mpv default value which saves:

As you can see included in that list is vid, aid and sub-delay. So IINA should be remembering the video track, audio track and subtitle delay if Resume last playback position is enabled.

However, the mpv Watch Later feature saves this state only if you stop playback by closing the window or quitting IINA. If you play the video until the end then the information will not be saved. If you use the playlist to start playing another video then the information will not be saved

If you want to check what the mpv Watch Later feature has saved, this Terminal: session shows me examining the contents of the watch later file for the movie I was playing: .

low-batt@gag ~$ md5 -qs '/Users/low-batt/Movies/resume-failure.mp4' | xargs -I % cat ~/Library/Application\ Support/com.colliderli.iina/watch_later/%
start=215.066667
pause=yes
brightness=-41
sub-scale=2.000000
low-batt@gag ~$ 

Use this command to check the file you are playing, substituting the full pathname to your file as I did in the above example:

md5 -qs 'put full path to file here' | xargs -I % cat ~/Library/Application\ Support/com.colliderli.iina/watch_later/%

NOTE that the full pathname to the file MUST exactly match or the MD5 hash will not be correctly calculated.

cmdedj commented 1 year ago

thank you very much. I have tried many times. Sometimes iina can remember the configuration I changed, but sometimes it will be restored to default. I don't know why.

cmdedj commented 1 year ago

| xargs -I % cat ~/Library/Application\ Support/com.colliderli.iina/watch_later/% start=2589.542000 fullscreen=yes sid=23

i only get the three information

cmdedj commented 1 year ago

and sometimes it will random choose a subtitle for me. its so weird

cmdedj commented 1 year ago

and i find if i open a new video in playlist, for example now i watch video A, then change to video B in playlist, then close the window in video B, quit iina and open the video A, the playback position of video A will be reset to the beginning.

low-batt commented 1 year ago

Thanks for responding with additional information.

I found time to do some testing. Because I don't have a file with multiple video and audio tracks I decided to test subtitles. That test failed. The selected subtitle track was not restored. See issue #4284. So there is a problem with sid and restoring the subtitle track.

On this:

and sometimes it will random choose a subtitle for me. its so weird

That is very interesting and could be related to issue #4284. Important question:

Are the subtitles external files or ones embedded in the video file?

Currently IINA uses its own methods for locating external subtitle files instead of mpv's. It could be that there is a race condition between IINA adding tracks and mpv restoring subtitle track selection. Just speculation. This behavior definitely needs investigation.

In the above testing sub-delay was properly restored. Are you sure subtitle delay is not being saved and restored for you?

The watch later file will not contain a value for an option if the value of that option is still set to the default. When testing be sure to select something other than the first track.

I definitely want to test preservation of the audio and video track selection. Currently I'm buried with other work that I need to get back to and finish.

On this:

and i find if i open a new video in playlist, for example now i watch video A, then change to video B in playlist, then close the window in video B, quit iina and open the video A, the playback position of video A will be reset to the beginning.

That is an entirely different issue. This is the expected behavior of the mpv watch later feature. When you start playing a video mpv will load the settings in the watch later file and then mpv will delete it. The setting will only be saved again if you don't allow playback to reach the end of the video and either close the IINA window or quit IINA.

This exact issue was raised in mpv issue https://github.com/mpv-player/mpv/issues/9300. This was the answer from the mpv project:

Use the write-watch-later-config command. You can either bind it to a key in input.conf by adding a line like F2 write-watch-later-config, or opening the console with ` and manually entering this command.

The last part about opening the console does not apply to IINA, but you can bind a key to that mpv command using the Key Bindings tab of IINA settings.

In general IINA avoids deviating from mpv behavior. With respects to this particular behavior it might be possible to add a setting to IINA that would save the watch later file when you click on another file in the playlist.

cmdedj commented 1 year ago

thank you for your reply in patience.

Are the subtitles external files or ones embedded in the video file?

the subtitles are embedded in the video file.

and if i download subtitles from the function in iina, next time i open video it will be deleted, i have to redownload again and choose one of it.

the sub-delay seem to work well in my memory. but if i set the sub delay in a subtitle, iina will apply the config to every video and subtitles, not the only one i want to change.

low-batt commented 1 year ago

Thanks again for the additional information.

the subtitles are embedded in the video file.

Really bad that embedded subtitles are not working properly. This will need to be investigated.

and if i download subtitles from the function in iina, next time i open video it will be deleted, i have to redownload again and choose one of it.

That is the expected behavior of the subtitle download feature. Once IINA has downloaded subtitles you can click on Save Downloaded Subtitle under the Subtitles menu to save the downloaded subtitles file for reuse.

the sub-delay seem to work well in my memory. but if i set the sub delay in a subtitle, iina will apply the config to every video and subtitles, not the only one i want to change.

That is yet another separate issue. I have just entered issue #4287 for that. Thank you for pointing this out. See that issue for details concerning that problem.