1

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: enter image description here

Marcus
  • 675
  • 2
  • 8
  • 24

1 Answers1

2

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:

Tanaike
  • 181,128
  • 11
  • 97
  • 165
  • Nice, thanks. If we use this method do we get charged for data transfer of files downloaded using this API key? I'm hoping not because the file is publicly shared from a personal Drive and not downloaded from our own Google storage? Would be good to clarify. – Marcus Nov 26 '20 at 06:24
  • @Marcus Thank you for replying. Drive API can be used by free of charge. When the usage limit exceeded, an error occurs. [Ref](https://developers.google.com/drive/api/v3/handle-errors) I think that these threads might be useful. https://stackoverflow.com/q/14156781 https://stackoverflow.com/q/10311969 – Tanaike Nov 26 '20 at 06:39
  • Apparently this method will be deprecated at some point? https://cloud.google.com/blog/products/application-development/upcoming-changes-to-the-google-drive-api-and-google-picker-api Would you be able to append your answer with the HTTP version of the same possibly? – Marcus Dec 10 '20 at 14:59
  • @Marcus In your URL, the query of `access_token` will be deprecated. In your case, the API key is used for the public content. In this case, the API key can be continue to be used. https://stackoverflow.com/a/46415475 – Tanaike Dec 11 '20 at 00:08