Closed maru801 closed 3 months ago
I'm not sure how jellyfin handles metadata of deleted videos so I guess I should check and see if there's an easy way to do that when media gets deleted.
Changing the resolution doesn't delete the files because you can have multiple resolutions that will automatically be used for higher/lower res displays. Again, I could theoretically delete all resolutions not listed in the BIF generation settings.
Generally my philosophy for this has been about space vs time. An already generated bif file is about 2-5MB, so you would need 1000 bif files just to equate a single movie. Generating that same bif file could take 2-20m depending on hardware, which definitely adds up. I figure people with 1000s of movies and TBs probably don't care about a couple MBs of extra bif files, and those who don't have the storage for that many movies also will never have many bif files. Still, I understand not wanting dangling files for media you've deleted, so I'll look into that (not that this gets many updates though).
As for the last part: jellyscrub doesnt copy the media anywhere and simply uses ffmpeg for image extraction. Its possible the file handle still existed and ffmpeg fully completed, as deleting a file only deletes the pointer, or that ffmpeg exited and used whatever images had already been extracted to create a BIF file. If the latter were the case, then anything after when you deleted the media would have the same/black trickplay images when seeking.
With regards to the last part of my original comment, to close this off, I didn't actually verify that the BIF file that was created was as it was supposed to be, or like you said, all black images after the part where the video got deleted. I didn't bother to reupload the video and look at the scrub file for it. The reason for my assumption was that after the deletion, my system's CPU usage remained at 50% for quite some time until it finished the task. I don't know what it was doing for that time, but the point is that something was happening.
Now to respond to my initial reasons for creating this issue. I do at times delete videos and reupload them with fixes that I made. Mainly with things like changes to the embedded subtitles. It's not uncommon for me at times while doing this, to have uploaded, and deleted the same video a couple of times, each having a different CRC-32 checksum at the end. Since the checksum is different, jellyscrub will see it as a different video file, and thus make a new process to create the BIF file again. This is not much an issue itself since I can always rename the BIF file to the new file before uploading it, or delete the old BIF files after the fact.
The two main issues for me then is that:
@maru801 That's a nifty way of doing things. It'd be nice to have a menu option to 'regenerate' BIF files either by Show, Season, Episode, Movie...etc. Beats trying to navigate the filesystem to find the right one and then waiting for a scheduled task to maybe find it unless you start playing the media.
Closing this as completed since Jellyscrub integrated with Jellyfin, and Jellyfin deletes all leftover trickplay files now within the config folder.
It seems that the files that are produced for the scrub will not remove themselves after a video has been deleted. I have them set to be stored in the media folders, not the config folder, and noticed that if I delete a video, the associated .bif & manifest.json files for it will remain until I manually delete them. Similarly, if you change the resolution at which your .bif files are generated, and then regenerate them on previous videos that already have existing .bif files, the old ones remain and the new ones get saved along them.
Would it be possible to implement a run task to jellyscrub that checks if a .bif's parent video still exists, and delete it if it doesn't? Similarly, it would be nice to have an option to overwrite existing .bif files so new changes to the scrub file resolution doesn't waste space by having the old files left undeleted,
On a side note, I got curious and decided to test if a .bif file would be generated if its video file got deleted mid-way. Turns out that when I uploaded a 30min video, started the .bif creation process, and then immediately deleted the video from the server, the .bif creation still happened. I thought this would just terminate the process, but now assume that it stores a temp copy of the video file somewhere instead of just reading off of the actual file location.