PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 29, 2022

[FIXED] How I can get First Frame as Photo from youtube?

 July 29, 2022     image, javascript, youtube     No comments   

Issue

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


Solution

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



Answered By - MarmiK
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing