javascript - How to make gif image from youtube video? -
anybody me want developing website using php code. gif-king website have completed jpeg image gif creator how create gif image youtube url yt2gif
i tried search google there not gives sufficient result fulfill requirement.
i got code upload video gif creator unable find script making youtube url gif creator.
i got 1 solution first download youtube video using youtube api. convert in gif images. not right way. unable convert in middle part. convert starting not possible download huge number of video youtube.
see process of creating gif images youtube url.
screenshot-1 :
copy youtube url
screenshot-2 :
paste in website http://www.gif-king.com/make-your-gif3 see below screenshot.
click on create gifs
after times video details appear see screenshot-3.
screenshot-3 :
after click on make gif
video convert gif.
it working small video. not working big video.
my php code:
ajax.php
if(isset($_request['vid'])){ $vidid=$_request['vid']; if($vidid){ include('curl.php'); include('youtube.php'); $tube = new youtube(); $links = $tube->get("http://www.youtube.com/watch?v=".$vidid); $getvideo=$links[3]['url']; //get avi video youtube $cate=mysql_query("select * category order id "); while($categoryname=mysql_fetch_array($cate)){ $getcatres .= '<option value="'.$categoryname['id'].'">'.$categoryname['name'].'</option>'; } if($getvideo) { $url = "http://gdata.youtube.com/feeds/api/videos/". $vidid; $doc = new domdocument; $doc->load($url); $title = $doc->getelementsbytagname("title")->item(0)->nodevalue; $duration = $doc->getelementsbytagname('duration')->item(0)->getattribute('seconds'); if($duration > 1200){ $array[] = array('result'=>'error','message'=>'error!!! maximum 20 minutes video allowed'); } else{ $newvideo = "gifking_".time().".avi"; $videouploaded=file_put_contents("myvideo/".$newvideo,file_get_contents($getvideo)); if($videouploaded){ $video='<iframe width="360" height="240" frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/'.$vidid.'?enablejsapi=1&playerapiid=ytplayer&version=3&cc_load_policy=0&iv_load_policy=3&modestbranding=1&rel=0&showinfo=0&theme=light"></iframe>'; $video_title='<input type="text" class="add-gif-textbox" name="title" id="title" placeholder="title" value="'.$title.'" />'; $category='<select class="add-gif-dropdown" id="cat_id" name="cat_id"> '.$getcatres.' </select>'; $tag='<input type="text" class="add-gif-textbox" name="tag" id="tag" placeholder="tiger,book,flower" />'; $submitbtn='<input id="button" class="button1" type="submit" value="make gif" name="submit">'; $array[] = array('result'=>'success','title'=>$video_title,'category'=>$category,'video'=>$video,'duration'=>$duration,'tag'=>$tag,'filename'=>$newvideo,'submit_btn'=>$submitbtn); } else{ $array[] = array('result'=>'error','message'=>'error!!! uploading image please try again'); } } } else{ $array[] = array('result'=>'error','message'=>'error!!! invalid video id'); } echo json_encode($array); } }
please suggest me how creating in php code?
it works totally easy, lucky you! here simple step-by-step program of that:
you first of download video youtube (or other video website not make specific). can done download program. exist, there popular ones.
then need video converter program. exist, there popular ones. extract each x frames image. take care timing right understand duration in milliseconds between each of x frames.
then merge image files of extracted frames again software can create animated gif. exist, there popular ones. take care here set timing right between frames.
then save gif image specific filename.
good news: done.
as far program of concerned (the programming question), find steps outlined in list above.
the implementation depends on tool suggestions off-topic here on site (but shouldn't show stopper each step above explained in detail within interwebs , seem clever enough use interwebs otherwise wouldn't have asked on stackoverflow).
good luck , have fun. let know how worked out!
Comments
Post a Comment