22

How I can get the first Frame in Youtube video as Image ?

or I have to use external too to help me to do this task?

thanks

user1560992
  • 227
  • 1
  • 2
  • 7

2 Answers2

54

For instance, if the video link is http://www.youtube.com/watch?v=JJrNopvzCy8

Extract the value of v and use it to download the the image..

Like:

http://img.youtube.com/vi/JJrNopvzCy8/0.jpg

I hope this will solve your problem,

Just be careful with the ?v=xxxxxxxx code

Note: For different frames, you may change the Number from 0.jpg to 1.jpg or more to fetch next frames of video in-case first starting frame of video is not required!

The Image will be by Default first frame of Video Size, so specify the image size in img tag, OR if sepcific size is must then use this YouTube Dev. API

Specific section in API link Thumbnails Section

OR we can try following example:

Video: https://www.youtube.com/watch?v=JJrNopvzCy8

  1. Default Thumb: http://i.ytimg.com/vi/JJrNopvzCy8/default.jpg

  2. MaxRes Thumb: http://i.ytimg.com/vi/JJrNopvzCy8/maxresdefault.jpg

  3. HQ Thumb: http://i.ytimg.com/vi/JJrNopvzCy8/hqdefault.jpg

  4. MQ Thumb: http://i.ytimg.com/vi/JJrNopvzCy8/mqdefault.jpg

  5. SD Thumb: http://i.ytimg.com/vi/JJrNopvzCy8/sddefault.jpg

Note: Some of the sizes will vary (OR may not be available as that follows resolutions available for the Video link)

Edit: For First Frame use this: http://img.youtube.com/vi/JJrNopvzCy8/0.jpg

MarmiK
  • 5,639
  • 6
  • 40
  • 49
  • 5
    For me, this does not give the "first" frame of the video, though. – agoldev Oct 18 '15 at 14:53
  • How can I get the image in a different size? – gdoron Jun 21 '16 at 10:58
  • Thanks for the response @MarmiK, specific size is indeed required. Which API should I look for? I couldn't find something related. – gdoron Jun 21 '16 at 12:03
  • 5
    Precisation: This tecnique will give you not the first frame but the thumbnail set by the author while uploading the video. Such thumbnail is, sometimes, set to the first frame, but not always. – Marco Marsala Mar 19 '18 at 12:06
0

To get first frame image from video you can upload the video on this URL (ezgif.com) and get image sequence preferably by generating image sequence between 0 to 1 second.

Once you have the first frame image, upload that image on youtube as thumbnail and then you can use @MarmiK answer above to get your using links like these http://i.ytimg.com/vi/JJrNopvzCy8/hqdefault.jpg

Imran Bughio
  • 4,811
  • 2
  • 30
  • 53