5

I intend to install ffmpeg and ffprobe to my Google App Engine flex environment, how can I do this with requirements.txt as a package ?

I am currently using ffmpeg-python yet, this is only a wrapper.

ffmpeg-python==0.2.0
ffprobe-python==1.0.3

Below is the error when I try to use ffmpeg-python wrapper, which is expected as there is no ffmpeg and ffprobe available :

2020-05-03 11:42:36 default[20200503t112932]  [03/May/2020 11:42:36] ERROR    [log.py:228] Internal Server Error: /capture_thumbnail/
2020-05-03 11:42:36 default[20200503t112932]  Traceback (most recent call last):    File "/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner      response = get_response(request)    File "/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response      response = self.process_exception_by_middleware(e, request)    File "/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response      response = wrapped_callback(request, *callback_args, **callback_kwargs)    File "/home/vmagent/app/core/views.py", line 62, in capture_thumbnail      generate_thumbnail(request, blob_uuid)    File "/home/vmagent/app/core/videointelligence1.py", line 264, in generate_thumbnail      probe = ffmpeg.probe(video_url)    File "/env/lib/python3.6/site-packages/ffmpeg/_probe.py", line 20, in probe      p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)    File "/opt/python3.6/lib/python3.6/subprocess.py", line 729, in __init__      restore_signals, start_new_session)    File "/opt/python3.6/lib/python3.6/subprocess.py", line 1364, in _execute_child      raise child_exception_type(errno_num, err_msg, err_filename)  FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe': 'ffprobe'

Can you please suggest a way, so I can use ffprobe on Google App Engine.

london_utku
  • 1,070
  • 2
  • 16
  • 36
  • Thanks @audionuma, from my understanding, that answer seems to be Google App Engine oriented. Yet, I believe there is no requirements.txt oriented solution as there is no actual ffmpeg package. – london_utku May 03 '20 at 12:57
  • 3
    Did u find a solution yet? I am also looking for the same – Aseem Jul 06 '20 at 22:56
  • 1
    Yes, I have found the solution, and the solution is not to install ffmpeg to Google App Engine, instead use a dynamically created VM Google Compute Engine instance for transcoding purposes. That is the only proper way. – london_utku Jul 07 '20 at 07:44
  • You can probably use a flexible environment. See https://cloud.google.com/appengine/docs/flexible – Miki Tebeka Jul 24 '21 at 07:16
  • No, I can't, all these App Engine Flexible or Cloud Run stuff has limited runtime capability, which is either 10 minutes or 30 minutes. The only way to achieve this is : To write a queueing mechanism, which will pick transcoding requests from a queue and execute it on a Google Cloud Compute Engine instance. – london_utku Jul 24 '21 at 11:34
  • Flexible environment does not solve problem, it has a limitation of some 30 minutes. What if you require more? You need to write a proper queue in Compute Engine, in a scalable way. @lazy1 – london_utku Jan 11 '22 at 22:41
  • 1
    Does anyone have step by step solution on how to execute this properly. We have been trying for 3 days with no luck! – Isis Curiel May 05 '23 at 14:39
  • @IsisCuriel, it won't work. You need to run this on Kubernetes on pods with Docker. Don't spend time with Google App Engine. – london_utku May 06 '23 at 02:00
  • 1
    thank you @london_utku we ended up switching to cloud run due to app engine limitations and added a docker with ffmpeg in it! – Isis Curiel May 09 '23 at 19:07

0 Answers0