FFMPEG using Google Drive API instead of Shared URL

孤者浪人 提交于 2021-02-08 08:57:58

问题


We are using FFMPEG to stream a Google Drive URL into a node application.

Is there an FFMPEG method or library we can use to stream to FFMPEG using the Google Drive API instead of using the standard public shared URL?

At the moment using the URL works fine if the file size is <100mb but with bigger files we get an error:

https://drive.google.com/uc?export=download&id=fileId: Invalid data found when processing input

This is because we reach the pesky gDrive virus roadblock page:


回答1:


From your question, I understood that your file is publicly shared. In this case, when the file size becomes large, the endpoint of https://drive.google.com/uc?export=download&id=fileId is required to be processed with 2 steps. Ref This has already been also mentioned in your question.

In this answer, in order to avoid this, I would like to propose to use the method of "Files: get" in Drive API and the API key. When Drive API and API key is used for the publicly shared file, no 2 step flow is required, and it can use it by changing only the URL.

Endpoint:

https://www.googleapis.com/drive/v3/files/{fileId}?alt=media&key={your API key}
  • For example, as a test, when you use curl command, you can use curl "https://www.googleapis.com/drive/v3/files/{fileId}?alt=media&key={your API key}".

References:

  • Download a file stored on Google Drive
  • Files: get
  • Using API keys


来源:https://stackoverflow.com/questions/65005736/ffmpeg-using-google-drive-api-instead-of-shared-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!