Skip to content
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

Use MediaInfo to extract resolution to determine quality before falling back to extension #448

Closed
SonarrBot opened this issue Sep 4, 2013 · 44 comments

Comments

@SonarrBot
Copy link

Right now we fallback to file extension to determine the quality of an episode file if the filename doesn't contain any quality information.

We should instead check the file with MediaInfo to determine the quality based on the resolution and fallback to extension if the resolution cannot be extracted.

@SonarrBot
Copy link
Author

Comment from ogimoore on Trello:

+1ing this feature. Using file extension in absence of a file name addition specifying the video quality is far from ideal, especially considering mediainfo is already built into Sonarr (from my understanding). I just had Sonarr bring in ~11,000 files, and almost all of them just defaulted to HDTV-720 due to my mkv extension.

@SonarrBot
Copy link
Author

Comment from zoggy on Trello:

@ogimoore majority of people get their releases from 'scene' which have pretty set guide/rules and dont really change containers very often. Thus it is pretty safe to assume that .mkv is hdtv and .mp4/avi is sdtv and .ts is rawhd. Now if the user doesnt like the 'assuming' they can provide a bit more info in the naming pattern of said files (quality) to prevent this. Can set quality after the fact and fix it later by having sonarr rename files. But anyways, using mediainfo is good but there is a hit that comes with it. Not everyone stores the files locally, a prime example would be bitcasa where the files 'appear' local but are actually remote. (fusefs) Thus if you want to run the file through mediainfo it has to download the file.. which can be costly.

@SonarrBot
Copy link
Author

Comment from zoggy on Trello:

@leeovery1 sb stores the original release names so previous info can still be referred to when renaming. thus you could just go add the quality to your naming pattern and have sb rename to put it in. thus when you import into sonarr, it will know what it is. then at that time you could then rename files again in sonarr to discard that info from the filename if you really dont want it there. (who even looks at filenames anymore in their media player?)

@SonarrBot
Copy link
Author

Comment from ogimoore on Trello:

@zoggy Thanks for the reply. I can't speak to everyones usage of Sonarr, as I can only discuss my case, which is where I have a significant blu-ray rip library done with makemkv (so no transcoding, just a rip to disk), however as the end file is saved as a mkv, Sonarr associates that with a 720p file (despite being a 10GB file for an hour long episode). I am worried that Sonarr may see a 1080p file on an indexer and think that an upgrade is available and download/overwrite the file that I ripped. I understand this can be potentially avoided through adding the quality to the file name (something I suppose I should consider changing up in the future)...

I don't have a feel at all for what the computational cost is associated with doing a mediainfo scan on each file Sonarr handles to determine what the quality of a video file is, so I cannot speak to that.

Thanks for the reply.

A designer knows he has arrived at perfection not when there is no longer anything to add, but when there is no longer anything to take away. -- Antoine de Saint-Exupery

@SonarrBot
Copy link
Author

Comment from zoggy on Trello:

the 'files' on a indexer are releases folders not actual files. thus the extension is not really known. so they can only go off the release name..which normally has a quality string in it. if it doesnt, 'unknown' is assumed. unknown qualities would not replace anything you have, unless forced/requested specifically. thus your concerns of a post-processing logic does not apply to the searching logic. plus sonarr has the ability to apply size filters to said quality to weed out things.

@SonarrBot
Copy link
Author

Comment from markus101 on Trello:

@ogimoore even with media info at best it would detect HDTV 1080p for a file that has a .mkv extension with a resolution of 1920x1080, its not going to be able to figure out that its actually a BR Rip without that info in the file name. Your concern is valid and will be an issue as long as the episode is monitored (wanted), but only overcome by having the info in the file names during import.

@SonarrBot
Copy link
Author

Comment from 0ne0fmany on Trello:

Another vote for this. I just started using Sonarr in place of Sickbeard and this is a huge issue. I record local channels OTA using Silicon Dust HD Homeruns, which record to .MPG files and then Sonarr/Sickbeard for anything which is missed or had errors. A half hour show averages around 3-4GB from OTA. Sonarr flags these 1080P files as SDTV and wants to replace them with 500MB 720P files. The program I use to record them doesn't have any method for adding a quality to the filename, so I'm kinda screwed unless I want to manually change the quality setting. I'll keep monitoring this card, but I'll have to head back to Sickbeard until then. I really like Sonarr otherwise!

@SonarrBot
Copy link
Author

Comment from markus101 on Trello:

@0ne0fMany if you're always recording 1080p then you could just add that to all file names.

@SonarrBot
Copy link
Author

Comment from 0ne0fmany on Trello:

@markus101 Thanks for the speedy comment on this. The program I'm using for recording (SageTV) doesn't have an option to change the default naming convention, which means I'd need to use a batch file after the fact and would first need to check if a file had already been renamed. There are also associated files (edl, txt, etc) which are created for various reasons and would also need to be renamed to match. I'm not a programmer, so this seems quite difficult to accomplish.

@SonarrBot
Copy link
Author

Comment from m0ul on Trello:

this would be very useful, since i have allot of anime geting imported as unkown

@j9ac9k
Copy link

j9ac9k commented Jun 19, 2015

Saw this issue has been migrated to github. Just posting to see if this is on the table currently.

Currently my file naming scheme is:

{Series Title} - S{season:00}E{episode:00} - {Episode Title}

I am considering using FileBot to rename all my episodes in such a way that Sonarr can properly detect quality.

I did notice that under Settings -> Media Management -> File Management there is an option to "Analyse video files". Am I correct to understand that some functionality like this issue describes is already integrated?

@reibejoy
Copy link

reibejoy commented Jul 9, 2015

I did notice that under Settings -> Media Management -> File Management there is an option to "Analyse video files". Am I correct to understand that some functionality like this issue describes is already integrated?

I asked myself the same question.

@Taloth
Copy link
Member

Taloth commented Jul 9, 2015

No it does not. the MediaInfo is currently only used for renaming.

@jarlave
Copy link

jarlave commented Dec 29, 2015

Anything new to this?

@Darkknight33
Copy link

Just want to add that this has been a major headache for me. Moved Sonarr from a Windows platform to Linux which was a complete disaster. Had to rebuild the entire database from scratch, like using Sonarr for the first time again (WTF?). It detected every existing series episode as 720p. There doesn't seem to be a way to manually mass edit files, and clicking one at a time on like 500 episodes is ridiculous. It'd be easier to directly edit the db with a query which shouldn't be necessary. Using mediainfo does incur a performance hit, and for some users working with remote files this is a real problem. However, there is no reason using mediainfo has to be mandatory or even the default. Just having it as an option would help a lot of users in situations like myself, or users converting from SickXXXX to Sonarr.

At the very least, if using MI is distasteful, Full season/show quality mass editing within the GUI would be really helpful.

@Taloth
Copy link
Member

Taloth commented Sep 26, 2016

Just want to add that this has been a major headache for me. Moved Sonarr from a Windows platform to Linux which was a complete disaster. Had to rebuild the entire database from scratch, like using Sonarr for the first time again (WTF?).

We actually mention that on the Backup and Restore wiki page. As you already mentioned, for now the easiest way is to update the paths in the sqlite editor, it isn't ideal but writing a migration helper isn't on the roadmap.

There doesn't seem to be a way to manually mass edit files, and clicking one at a time on like 500 episodes is ridiculous

There is: (both on the Series and Season level)
image

(But I do feel sorry for you that you had to click 500 episodes one by one, only to discover it could've been faster.)

Btw. we still like to include mediainfo information to determine the file quality. It also helps against misnamed releases. That's why this issue is still open.

@j9ac9k
Copy link

j9ac9k commented Sep 26, 2016

@Taloth glad to hear the issue is still being considered. I don't know if I will be of much help coding (maybe a little?) but if there is something that I can do to help (testing?) let me know and I'll be happy to assist.

@JAC2703
Copy link

JAC2703 commented Oct 3, 2016

+1

@daiken002
Copy link

daiken002 commented Nov 19, 2016

I also made a comment under #457.
I have been able to setup Sonarr and iTunes to work together happily except for the following.

When scanning files, Sonarr detects iTunes 720p files as SDTV due to the (HD) marker, which is iTunes only puts the resolution in the 1080p files. eg.:

SD = 1-01 Pilot.m4v
720p = 1-01 Pilot (HD).m4v
1080p = 1-01 Pilot (1080p HD).m4v

I thought if this is not something that can be automatically done, then maybe since people often have their own naming conventions there could be a place on the Quality Definitions settings page (on the right of each line after the size limit sliders) for people to specify their only quality filename markers or naming convention for each specific quality.

@tomsommer
Copy link

tomsommer commented Nov 22, 2016

+1, should be part of the "Analyse video files" feature

@imran-iq
Copy link

imran-iq commented Dec 2, 2016

Would definitely love "Analyse video files" feature (just migrated so everything is now 720p 😢 )

@dwhagar
Copy link

dwhagar commented Dec 27, 2016

I understand that this issue seems to somehow not get a lot of traction with developers. I'm not sure why, other than the fact that one could add a general "720p" "1080p" monikers as defaults, fall back to media info, then have Sonarr recognize that sometimes it isn't going to know HDTV or BRip or anything else, but still should recognize that they are HD files.

I've had this problem for a while myself. I use a program called iVI Pro to convert everything I download into a format suited for my needs (also sets metadata within the mp4 format) this renames the files as it does, which is nice because occasionally files come across my desk that are named really strange things, so those files go into a kind of purgatory waiting for me to tell iVI Pro what they are. Once this happens, iVI Pro sets a naming scheme that works for, well, nearly anything.

It can't be that hard, I'm personally considering writing a Python Script of my own to get some renaming done, which should be trivial. Developers could also allow people to specify what they want the default to be rather than hard-coding it in, I don't think it is fair to assume that anything with the mp4 or m4v extensions is SD, or that all mkv files are 720p, to me that is just plain lazy (no offense) when SO MANY other methods can be used to determine resolution trivially!

Please, developers, just add the ability to do this simple yet powerful task.

@Arkymedes
Copy link

+1

Just migrated and started to use the excellent sickbeard_mp4_automator and ALL my files are marked as SD.

Badly needed feature.

@IwishIcanFLighT
Copy link

Any update on this issue?

@markus101
Copy link
Member

markus101 commented May 7, 2017

Some thoughts regarding the implementation:

This shouldn't be tied to "quality parsing" since it's not parsing the quality, but enhancing what was parsed. In some ways this fits with the advanced parser (#457), though it could be done without the work required for that, the advanced parser would clean up some of the implementation though.

  • Using media info as part of the quality detection process would augment the information parsed from the file/folder/download client name
  • The augmenting would allow the resolution to change based on resolution of the file (if the filename contained the wrong resolution or a poorly formatted one)
  • Augmenting would override extension only quality parsing completely (.mp4=SDTVwould be thrown away if the resolution was really 720p and it would becomeHDTV-720p`)
  • Augmenting would be similar to what the (poorly named) ParsingService is, where given information parsed from the release would return a more complete result (series, episodes, quality, etc)
  • This augmenting would replace the logic in ImportDecisionMaker that uses the folder quality over the file quality

markus101 added a commit that referenced this issue Aug 26, 2017
New: Use media info during import to extract resolution for quality
Closes #448
markus101 added a commit that referenced this issue Aug 27, 2017
New: Use media info during import to extract resolution for quality
Closes #448
@kmr2319
Copy link

kmr2319 commented Sep 11, 2017

Just another confirmation of problems that the lack of this feature can cause...

As @Arkymedes also noted, when using sickbeard_mp4_automator, all converted files are tagged as SDTV after conversion.

This may then cause a re-download since SDTV doesn't match the required quality. For example:
image

Thanks for your efforts!

@TheFirstQuestion
Copy link

For those interested, I've created a script that, while it doesn't really solve this problem, will hopefully help users who are struggling with this issue.

https://github.com/TheFirstQuestion/VideoResolutionRenamer

Any feedback is appreciated! If my code can assist in adding this feature to Sonarr, that would be wonderful.

@kmr2319
Copy link

kmr2319 commented Sep 26, 2017

@markus101 Any ETA for when PR #2146 will be merged and released? This one is super annoying. Thanks for your efforts!

markus101 added a commit that referenced this issue Dec 1, 2017
New: Use media info during import to extract resolution for quality
Closes #448
@Sonarr Sonarr deleted a comment from WireCrazii Jan 26, 2018
markus101 added a commit that referenced this issue Jan 27, 2018
New: Use media info during import to extract resolution for quality
Closes #448
markus101 added a commit that referenced this issue Jan 27, 2018
New: Use media info during import to extract resolution for quality
Closes #448
Closes #1105
markus101 added a commit that referenced this issue Feb 1, 2018
New: Use media info during import to extract resolution for quality
Closes #448
markus101 added a commit that referenced this issue Feb 1, 2018
New: Use media info during import to extract resolution for quality
Closes #448
Closes #1105
markus101 added a commit that referenced this issue Feb 12, 2018
New: Use media info during import to extract resolution for quality
Closes #448
markus101 added a commit that referenced this issue Feb 12, 2018
New: Use media info during import to extract resolution for quality
Closes #448
Closes #1105
markus101 added a commit that referenced this issue Feb 12, 2018
New: Use media info during import to extract resolution for quality
Closes #448
Closes #1105
markus101 added a commit that referenced this issue Feb 12, 2018
New: Use media info during import to extract resolution for quality
Closes #448
Closes #1105
@scutzi128
Copy link

Any progress on this? I had my drivepool disconnected due to an issue and sonarr basically reset all my files to 720p quality when everything was resolved even though the vast majority is 1080p. This is an issue because now its starting to download things I already have.

Taloth pushed a commit that referenced this issue Apr 11, 2018
New: Use media info during import to extract resolution for quality
Closes #448
@Taloth Taloth closed this as completed in 81e385b Apr 14, 2018
@DrSeussFreak
Copy link

DrSeussFreak commented May 25, 2018

I see this is marked closed, again, but I just migrated from Windows to Ubuntu, and I can tell you that it is absolutely not working. all MP4s are marked as SD and ALL MKVs are marked as 720p.

@majorsl
Copy link

majorsl commented Jul 8, 2018

I just started to setup Sonarr and came here just to find this. All my existing series (mkv) are marked 720p. What a complete disappointment. Unfortunately, this is a deal breaker for me using Sonarr. I would have thought the ability to analyze files would have already been in a project this mature.

@markus101
Copy link
Member

If you're having issues with an implemented feature open a thread on the forums for support.

@Taloth
Copy link
Member

Taloth commented Jul 8, 2018

The feature to process mediainfo to determine the resolution was released in version 5225/5228 around mid june 2018. But it's not going to be as accurate as a filename tag since you can't determine hdtv/web/bluray etc from mediainfo.

Nevertheless, if you encounter specific issues with it, please post it on the forums.

@majorsl
Copy link

majorsl commented Jul 8, 2018

Thank you, I will. I am pretty certain it isn't working - I don't expect it to figure out "source" for items I have, but it definitely hasn't tagged any mkv as at least 1080p which I have most of. Duly noted file name is the best option.

@biship
Copy link

biship commented Jul 8, 2018

Those forums are useless. The way to report open source bugs is via a github issue. The issue here still exists. Stop trying to shoe people way to a dead end.

@justin8
Copy link

justin8 commented Jul 9, 2018

I ended up writing my own script to inspect the quality and append it to the filenames when I had to rebuild my sonarr database.

The mediainfo support as it is today is beyond useless. I don't care about bluray/hdtv/etc, I mostly just wanted the resolution to be reflected correctly since that is what I'm replacing poor-quality files based on.

@markus101
Copy link
Member

Absent any proof it being beyond useless means absolutely nothing... I ran a couple sample files through and they worked exactly how they should:
image

Both files in Season 1 are 1080p files and the file in season 2 is 2160p. For files already in the series folder Analyse Video Files needs to be enabled, otherwise mediainfo is not read in. All imports read media info though.

If it's not working for your please provide information that we can use to actually fix it.

@biship I get it, you don't like the forums, but your comment provides no value to the discussion. We'll continue to use the forums for support and github to track issues/bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests