[HN Gopher] Show HN: YTPics - Download pictures from YouTube videos
       ___________________________________________________________________
        
       Show HN: YTPics - Download pictures from YouTube videos
        
       Lack of yt-dlp+ffmpeg and screenshots' limited size on my mobile
       phone prompted me to build a simple tool to download pictures from
       YouTube videos. Check it out. hope you guys find it useful
        
       Author : web0_cc
       Score  : 107 points
       Date   : 2024-02-07 10:39 UTC (12 hours ago)
        
 (HTM) web link (www.ytpics.com)
 (TXT) w3m dump (www.ytpics.com)
        
       | hiAndrewQuinn wrote:
       | This is exactly the kind of thing I need for grabbing images for
       | my Finnish news backup and studying site. Thank you!
        
       | darrenf wrote:
       | By "pictures" does this mean individual frames? FYI on desktop
       | using an up to date Chrome, you can right click twice - slowly,
       | _not a double-click_ - and choose  "Save video frame as..." (on
       | macOS, at least)
        
         | web0_cc wrote:
         | Thats true. its for mobile devices which lack desktop browser
         | features and extentsions
        
         | explaingarlic wrote:
         | Still helps to know that you have a consistent way of doing it,
         | especially if you do it a lot.
        
         | abrugsch wrote:
         | Also works on Windows, Firefox (labeled as "Take Snapshot"
         | though)
        
       | Brajeshwar wrote:
       | I tend to use VLC for this. http://www.videolan.org/
        
         | cyrusmg wrote:
         | How is that done ?
        
           | Brajeshwar wrote:
           | VLC has the option to "Take Snapshot" and it can play online
           | media. This is unless I'm missing something very obvious!
        
             | gsky wrote:
             | In the description it says app is for mobile devices
        
               | Brajeshwar wrote:
               | My bad; I'm sorry for jumping into conclusions.
        
               | the_third_wave wrote:
               | VLC runs on mobile devices:
               | https://www.videolan.org/vlc/download-android.html
        
               | pxeger1 wrote:
               | It's nowhere near as powerful though, and I don't think
               | it can do this particular task.
        
               | the_third_wave wrote:
               | It is a full port of VLC so it should be able to handle
               | this task. You're probably referring to the frontend
               | which differs from the ones used on desktop but that does
               | not mean the functionality is not available. It is, you
               | just access it differently. Either enable the 'Take a
               | screenshot' option ( _Controls Settings - > Take a
               | screenshot_) and use that or send an intent to do so. The
               | former works while watching videos, the latter makes it
               | possible to automate this task from within _termux_ ,
               | _Tasker_ or _Automagic_.
               | 
               | You can also just install _vlc_ in _termux_ and use the
               | command line interface:                  ~ $ apt search
               | vlc        Sorting... Done        Full Text Search...
               | Done        vlc/stable 3.0.18-7 aarch64          A
               | popular libre and open source media player and multimedia
               | engine             vlc-qt/x11 3.0.18-7 aarch64          A
               | popular libre and open source media player and multimedia
               | engine             vlc-qt-static/x11 3.0.18-7 aarch64
               | Static libraries for vlc-qt             vlc-static/stable
               | 3.0.18-7 aarch64          Static libraries for vlc
        
       | Qwertas wrote:
       | This addon works perfectly for this
       | https://chrome.google.com/webstore/detail/screenshot-youtube...
        
         | bastijn wrote:
         | I giggled at "This extension does not contain any malicious or
         | tracking code. No viruses. No ads. Only good software.". If
         | only everybody added this statement we would not have malicious
         | addons.
        
       | 55555 wrote:
       | A one line combination of YouTube-dl and ffmpeg can do this btw
       | (without downloading the whole video)
        
         | KeplerBoy wrote:
         | This would be a good place to share that one line.
        
           | web0_cc wrote:
           | yt-dlp ${youtube_video_url} --get-url
           | 
           | ffmpeg -ss ${seconds} -i "${first_url_from_yt-dlp}" -t 1 -r
           | 4/1 -q:v 2 -vf scale="0:-1" ${target}
           | 
           | -r 4/1: 4 frames per second
           | 
           | Again this app is for mobile devices which lack yt-dlp+ffmpeg
        
             | tjoff wrote:
             | Nice, if you install termux (from fdroid) you can run it
             | directly on your android.
        
             | vitehozonage wrote:
             | Does this really not download the whole video? I havent
             | checked but im just surprised that it's possible
        
               | thrdbndndn wrote:
               | No it doesn't. FFMPEG can seek video directly without
               | loading all the content, even for Dash/HLS (but in this
               | case yt-dlp typically returns a plain HTTP source, which
               | I assume internally FFMPEG uses HTTP header range to
               | seek?)
               | 
               | Keep in mind you need to make sure to use input seeking,
               | though (-ss before -i).
               | 
               | Also I'm not sure why they need `-vf scale="0:-1"` part.
        
             | edotrajan wrote:
             | Is it possible to get one screenshot from different periods
             | of the same video like 10%, 20%, 30%, 40%, 50%, 60%, 70%,
             | 80% with just one command.
             | 
             | If yes, could you please share for me here, it'd be really
             | helpful, thanks
        
         | codetrotter wrote:
         | I was gonna say that realistically your one liner is gonna need
         | to be ran probably 20, 30 times before you're able to pick the
         | exact frame that you want.
         | 
         | But with a little bit extra work you could make that one liner
         | into a script that will extract a range of frames surrounding
         | the chosen timestamp.
        
       | KomoD wrote:
       | Just works, no complaints from me
        
       | Beijinger wrote:
       | I have extracted frames with vlc before before. They always look
       | like shit. Like with a lower resolution. Why? Like if you freeze
       | a youtube video the pic looks clean.
        
         | lupusreal wrote:
         | I think that's just VLC being VLC, or maybe VLC's youtube
         | support doesn't get the high quality streams. When I play
         | youtube videos with mpv (which uses yt-dlp), 's' to snapshot
         | produces clean images.
        
         | thebruce87m wrote:
         | If you use ffmpeg with png you will get sharper images. I was
         | trying to extract a numberplate once and this worked out best.
        
         | Retr0id wrote:
         | It's basically an optical illusion. When things are in motion,
         | your brain is better at ignoring the compression artifacts.
         | When they're still, they're glaringly obvious.
        
           | throawayonthe wrote:
           | parent comment specifically said that when frozen in player
           | it looks clean
        
         | teitoklien wrote:
         | During streaming, lower res image frames are sent, to avoid
         | buffering as much as possible, depending on your internet speed
         | the res increases or decreases
         | 
         | When you stop the frame, the video can download the highest res
         | version without any problem, so you get crystal clear glimpse
         | when paused, but blurry images when film is rolling.
        
           | metadat wrote:
           | > When you stop the frame, the video can download the highest
           | res version without any problem, so you get crystal clear
           | glimpse when paused, but blurry images when film is rolling.
           | 
           | If this were the case, when the player is paused and the
           | "higher resolution frame" downloaded, there would be a
           | discernable delay due to network and download latency, which
           | I'm 100% certain is not the case. Pause any YT video and it
           | is instantaneous with no perceivable delay or jank.
           | 
           |  _Edit: @teitoklien thank you for the correction about
           | Adaptive Bitrate Streaming, I 've removed this part of my
           | reply so as to not spread misinformation. Sorry for any
           | confusion!_
        
             | teitoklien wrote:
             | Um, no. You are wrong
             | 
             | Look into Adaptive Bitrate Streaming [0]. From what I've
             | read HLS does work this way, when combined with Adaptive
             | Bitrate streaming, the segment files are swapped midway
             | depending on user device and connection quality (with each
             | video segment being kept encoded at various qualities to
             | change between as connection quality varies)
             | 
             | The screenshot thing is a fair question tho, why pausing
             | leads to higher res. I think some players, do it custom,
             | for User Experience, so that they can produce clean
             | screenshots on pausing. I've seen YouTube do it for sure.
             | 
             | But for you're main point, you're objectively wrong,
             | adaptive bit rates and swappable segment files are a thing.
             | 
             | Edit: (Don't worry about it, being wrong is good hehe, i
             | was wrong 7 times today while doing my work, helped me
             | learn new things 3 out of those times, you helped me
             | question myself and look back at my knowledge too, it's
             | been dusty for a while. Have a great day!)
             | 
             | [0]
             | https://en.m.wikipedia.org/wiki/Adaptive_bitrate_streaming
        
       | veggieWHITES wrote:
       | Very cool. Just curious, is this legal? I would assume the
       | legality falls on the user of the service?
        
         | Solvency wrote:
         | Is taking screenshots of a paused YouTube video illegal?
        
           | Retr0id wrote:
           | Certain rights-holders want us believe that taking
           | screenshots at 24Hz is illegal (see: youtube-dl takedowns)
        
       | SamBam wrote:
       | Do any armchair lawyers (I know, I get what I pay for) want to
       | chime in on the legality of creating user-definable 3-5 second
       | gifs of YouTube videos, which link back to the video in question,
       | for an online video curation library thing?
        
         | Arelius wrote:
         | I mean, you will almost certainly be in a constant state of
         | creating material in violation or copyright. Depending on the
         | details of any specific copyright violation, it may be
         | protected by Fair-use, and the length and lack of audio will
         | likely help in your favor. But you'd have to defend those cases
         | individually in court to even begin to make a fair-use
         | argument. And I dont see how you could ever win any blanket
         | decision in your favor.
         | 
         | With a good DMCA takedown story and compliance, you could
         | potentially claim the copyright is responsibility of your
         | users. And maybe you'll be too small, and the content, in
         | general you are making too inconsequential, or even helpful
         | (marketing wise) for anyone to care. But this is definitely be
         | a project I would get a proper legal analysis of and have clear
         | procedures and plans in place for any issues that may show up.
        
       | rkagerer wrote:
       | It would be neat if your UI let you step through frames
       | (visually) to find the exact one you want.
        
       | adellsworth wrote:
       | I use this ff add-on which adds a handy button direct to the
       | player itself: https://github.com/gurumukhi/youtube-screenshot
       | 
       | looks like it just renders the current frame to a canvas element
       | and saves it. https://github.com/gurumukhi/youtube-
       | screenshot/blob/master/...
        
       ___________________________________________________________________
       (page generated 2024-02-07 23:00 UTC)