10

I am working on youtube data api v3 to upload an image and an audio as video with image will be displayed as a video.

I can able to upload videos as it is already given as an example.

I tried thumbnail: $('#file_image').val(), to set video thumbnail. But it didn't work as I expected. I also search over the internet to get an idea. But didn't get any idea.

UploadVideo.prototype.uploadFile = function(file) {
  var metadata = {
    snippet: {
      title: $('#title').val(),
      description: $('#description').text(),
      tags: this.tags,
      thumbnail: $('#file_image').val(),
      categoryId: this.categoryId
    },

Is this feature achievable using youtube data api? I knew that we can upload an image and audio together works as video in youtube (not through API).

Youtube reference url

Youtube data api Reference

UPDATE:

Using ffmpeg we can able to create a video by combining audio and image. The created video uploaded to Youtube via Youtube DATA API. It works. Now I am trying to automate the following scenario using a script.

Upload Image and Audio. Create the video using ffmpeg. Once video successfully created, upload the video using Youtube DATA API.

I can able to create a video using ffmpeg commands in command line. But when I try to use PHP code, the command is not executing.

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
Gunaseelan
  • 2,494
  • 5
  • 36
  • 43
  • Sounds like you're asking 2 questions. Are you trying to upload images + audio to YouTube? Or are you trying to set the thumbnail of an existing video? – approxiblue Jun 06 '15 at 03:06
  • I am trying to upload images + audio as video to youtube – Gunaseelan Jun 06 '15 at 06:44
  • @user880772 It is not 2 questions. It is one question. you have the feature of combining audio and image together as a video(not through Youtube data api) in youtube. Shall we do it through api? that is what I am asking. I am still trying. – Gunaseelan Jun 09 '15 at 11:30

3 Answers3

4

You can use ffmpeg to make a slideshow. Then upload the resulting video. https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images

Yetti99
  • 326
  • 2
  • 11
3

At the moment, no, unfortunately. According to the support article you posted, "Upload audio or image files", there is no API to upload images and audio separately and let YouTube combine them for you. You have to either:

  • Combine images and audio yourself and upload the resulting video
  • Use YouTube's slideshow maker on the upload page
approxiblue
  • 6,982
  • 16
  • 51
  • 59
  • This wasn't possible in [the v2 API either](http://stackoverflow.com/questions/14266510/upload-slideshow-to-youtube). – approxiblue Jun 06 '15 at 16:31
  • thanks for the answer. But there is a feature in youtube where we can choose an image and an audio that will make a video (not by Youtube data api) – Gunaseelan Jun 07 '15 at 03:35
1

If your browser demand is limited to Chrome and Firefox you can use whammy.js to create a webm client side. That browser generated video can later be uploaded to youtube. The problem is that whammy doesn't support sound. Maybe you can use Amazon's elastic transcoder to combine video and sound.

https://github.com/antimatter15/whammy

http://aws.amazon.com/elastictranscoder/

Another option is to run ffmpeg as someone mentioned. There is actually a JS version of ffmpeg you can us, I haven't tried it my self but you can find it here.

https://bgrins.github.io/videoconverter.js/

arpo
  • 1,831
  • 2
  • 27
  • 48
  • I created video with images as background image using whammy.js earlier as you mentioned. Due to the sound support problem in whammy I didn't make a progress using whammy.js after that. – Gunaseelan Jun 12 '15 at 07:35
  • No that's a shame. I'm looking for the same solution as you but have not come any further than this. – arpo Jun 12 '15 at 07:40
  • Before you answer my question, I tried whammy.js and got success by creating video without sound. The official documentation shows that sound is not supported. I am amazed how you can move further to add audio to video(that we created) using whammy.js? – Gunaseelan Jun 12 '15 at 07:49
  • I haven't succeeded on adding sound unfortunately. You seems to be good at PHP. Have you had a look at: http://ffmpeg-php.sourceforge.net/ – arpo Jun 12 '15 at 08:22
  • Yes. I created a video using ffmpeg. now I am trying to upload the created video to youtube using script. – Gunaseelan Jun 12 '15 at 11:23