-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DupFileManager][Feature] Swap files based on codec #431
Comments
I can do that, but to be honest, I'm not that knowledgeable on what is a better codec. bit_rate looks like that's an easy option to add, because the higher the number, the better the video. The same thing can be said for frame_rate. But the video_codec is not that simplistic. It doesn't list a number, and instead it list a type. I need to find a good source showing the ranking for video_codec, so the code can determine which codec is better. In my stash library I have over 30000 video files, and I just did a SQL query to get all the unique values for the video_codec.
I would have to rank the above list, and check if there are other codec's that are not in my collection. If you're familiar with codecs and know their ranking, that would help. |
There isn't a real way to determine which source file is better based on video codec or bitrate. Video codec matters to determine if your device can play it, which will vary from different hardware to different browser choice. Bitrate, while an important quality measure in totality, doesn't really help with you with determining quality on its own. It will be determined by file size which is affected by video and audio codecs, resolution, etc. |
I especially agree with respect to the video codec.
What I could do is include this in the DupFileManager_config.py, where the user can both enable codec ranking and modify the desired ranking order. # If enabled, favor videos with better codec according to codecRanking
"favorCodecRanking" : False,
# Codec Ranking in order of preference
"codecRanking" : ["h266", "vp9", "av1", "h265", "h264", "h263", "h263i", "vp8", "vp6f", "mpeg4", "msmpeg4v3", "msmpeg4v2", "msmpeg4v1", "vc-1", "vc1", "AVC", "mpeg2", "mpeg2video", "wmv3", "wmv2", "wmv1", "mpeg1", "mpeg1video", "flv1", "png", "gif" ],
# If enabled, favor videos with higher value bit rate
"favorBitRate" : False,
# If enabled, favor videos with higher value frame rate
"favorFrameRate" : False, |
The ranking is flawed by design. It prioritizes maximum potential efficiency, which is not only situational and vary per usage type, but each decoder have their own quality settings when encoding the video which simple codec type reading doesn't take into account. |
That's why I implemented the code in the configuration file, where the user can decide what is most important, and what codec is preferential. FYI: I like the way you phrased it, and I'm putting that in the comment in the config file to state the default order.
|
Yea agree, the codec discussion can be opinionated or sometimes even esotheric. So yea, to be able to configure your codec ranking is in my opinion the best solution. Maybe to make it easier for the user is to group them? Somethin like High efficiency group: h265, Vp9, h266, av1... Compatibility group:h264, vp8, mpeg4... Same for bit rate. best solution here I guess would be to give two options: Prefer fidelity or efficency. So you would first decide which codec and then within codecs you rank by bit rate. (Given the files are the same resolution). Another approach could be similar to what Sonarr/Whisparr does: Filesize/Duration... |
I'm not sure I understand. Are you saying to have option to favor lower bit_rate over a higher bit_rate? |
yea. It would be just be a nice to have tho. I personally prefer higher bit rate. But I would guess there are users that need to watch their file sizes or exclusively watch on phones etc... |
compression will affect different videos in different ways, actually comparing the input and the output would be the best way to compare. The only "objective" way I know of would be with something like VMAF but requires the unaltered source to compare against. Most people will just care about compatibility for codec so H.254 may be more important, as for quality I personally like to use bitrate per pixel to get a rough estimate of quality across resolutions. Best option is to provide a customization and a reasonable default which is kind of the whole premise behind phashDuplicateTagger |
Interesting plugin. It's similar to DupFileManager. I like the compare_bitrate_per_pixel function. Why is generate_phash needed? Why would PHASHs be missing in some scenes? FYI: |
The phashDuplicateTagger plugin would be hard to use for a non-programmer. You want customization that the average user can configure without having to know python. |
CODEC_PRIORITY is not intended to be comprehensive it's just to prioritize specific codecs that the user might want
|
Thanks for the reply, but I think you grab the wrong quotes from my comments, or I don't understand the reply association with my question. stash.metadata_generate({"phashes": True}) The phashDuplicateTagger task associated with this states the following: |
Generating a PHASH for each scene is not a requirement for Stash, you can have situations where scenes don't have a PHASH either by configuration or most likely when ffmpeg cannot open the file or errors for some reason during the generate process I seem to remember the task was a request and the plugin primally uses PHASHes to detect dupes so it was added as a shortcut for those that don't know how to run the generate task |
The swap codec logic has been added to Axter-Stash->DupFileManager. Can you please close this item. |
I'll close the issue once it's added to this repo. |
@David-Maisonave thank you for the handy plugin.
Do you plan to integrate the ability to swap files based on codec or even bitrate?
Would be awesome.
The text was updated successfully, but these errors were encountered: