vicwomg / pikaraoke

Youtube-based Karaoke machine for Raspberry Pi, OSX, Windows, and Linux
519 stars 136 forks source link

Is there a way to detect videos with no on-screen lyrics? #33

Closed Hartebee5t closed 4 years ago

Hartebee5t commented 4 years ago

It occurs to me that there might be a youtube-dl option we could use to detect videos containing only a static image (implying there are no on-screen lyrics). It feels like more than half of the search-hits claiming to be karaoke tracks are audio-only rips with a screenshot of the cover of the disc instead of lyrics. It would be great to be able to distinguish the search results list to highlight (or rather 'low-light') the titles of such videos, if a method could be found to detect them.

A more complete solution might be to provide a side-search option for a lyrics page to display over such audio-only backing tracks. Not as good as a proper rolling karaoke live-lyric visual, but far better than no lyrics at all. For now, though, I'd be happy with a lyric-less detection method.

petemarvin commented 4 years ago

At first it was also a problem to me. An idea occured to me by using the built-in youtube thumbnail. There is at least 4 available thumbnails, 3 of which is a snapshot of the video contents. After choosing in the dropdown search result it will display the animated thumbnails below the link.

I have made branch in my forked repo https://github.com/petemarvin/pikaraoke/tree/yt-thumb or you might check a quick demo https://jsfiddle.net/petemarvin/231unk7x/ for your reference.

Haven't made a pull request yet since I'm still trying to figure out how to include also the view counts. I Believe if there is a low view count, the more it is fake karaoke video 😁.

vicwomg commented 4 years ago

Wow @petemarvin you're killing it with the enhancements! That would be a great addition when you get it working. Thank you. You're really keeping me on my toes.

The default search results object from youtube-dl includes a TON of metadata, including screenshots, view count, I'm sure. However, it really makes search very slow. If there's a way to filter the result object to include the bare minimum of data, that would be nice. I didn't find one, but didn't search too hard.

Another simple idea is that if there's a good online lyrics website with an api, maybe we can throw a link under the now playing to bring up backup lyrics on your mobile browser.

petemarvin commented 4 years ago

I agree it did really made the search slow and I guess getting the view_count information is not worth it. Anyways I'm satisfied if I am able to get the visual screenshot of the video content.

As for the lyrics I would suggest putting just a link "Search Lyrics on the Web" or just a small search icon beside the now playing/queued songs, the link target is pre-filled with the search term using the filename. I guess Google search https://www.google.com/search?q=Modern+Loneliness+-+Lauv+lyrics can give more accurate lyrics or maybe using https://search.azlyrics.com/search.php?q=Modern+Loneliness+-+Lauv

Hartebee5t commented 4 years ago

Thanks for this @petemarvin.

Even without installing the modified code (just scraping from it the syntax for the 'img.youtube.com/vi...jpg' URL and re-constructing a few test instances of it in my browser) I can see the promise of this technique.

At present, in PiKaraoke, I choose a candidate search result from the list and then click back on the Search page's green youtube hyperlink to see if the video has lyrics, [Esc]aping back to the results list if it hasn't. Wouldn't it be great if, instead, there was an option on each result in the list to use the 'img.youtube.com/vi/...jpg' URL to retrieve and pop-up (or even 'digitally compare'?) the three thumbnails of the chosen candidate result so the user can see if they match (implying it's a static screenshot, rather than lyrics). Would that avoid the time-hit incurred by retrieving the search object for every result (because it's directly retrieving just the images of the chosen candidate item and not the full object of all of them)?

vicwomg commented 4 years ago

@Hartebee5t the pikaraoke implementation of the animated screenshot preview is already in the development branch if you want to see it.

Interesting idea, but I think the image diff would always return true, due to compression noise. Unless we used some kind of fuzzy image matching library, and I fear that would bog down the CPU. Also, no guarantee it wouldn't return false positives. The screenshots could all turn out to fall on blank frames, for instance.

Hartebee5t commented 4 years ago

Right-o. I'll try the dev branch instance.

On the digital match thing, I'd guessed as much - that aspect was a bit of a throwaway suggestion.

Hartebee5t commented 4 years ago

@Hartebee5t the pikaraoke implementation of the animated screenshot preview is already in the development branch if you want to see it.

Wow! Just tried the dev branch version for the animated screenshot images from the selected search result and it works a treat! The lyricless cover-shot images stand out a mile. That's a brilliant new feature.

vicwomg commented 4 years ago

@petemarvin 's solution is elegant and works great. It's now in master