Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint used for downloading fails for video with ID awjBLm41xJI when using bestvideo+bestaudio. #27

Open
DavidBerdik opened this issue Nov 8, 2022 · 3 comments
Assignees

Comments

@DavidBerdik
Copy link

I have found a scenario in which trying to use the endpoint for downloading a video using bestvideo+bestaudio fails.

To reproduce:

  1. Run youtube-dl-web.
  2. Browse directly to the following URL: http://localhost/api/dl/awjBLm41xJI?f=bestvideo%2Bbestaudio
  3. Instead of the download process beginning, you will receive the following error text: Internal Server Error
  4. Check the log of the youtube-dl-web-server container. The log will contain the following stack trace which was generated from the failed download attempt.
[awjBLm41xJI]: requested with format bestvideo+bestaudio and subs None, configuring...
[awjBLm41xJI]: sending stream
[awjBLm41xJI]: stream will be merged (bestvideo+bestaudio)
[awjBLm41xJI]: end of data (no error reported)
cleanup[awjBLm41xJI]: killing downloader process (PID: 62)
INFO:     172.19.0.2:55686 - "GET /dl/awjBLm41xJI?f=bestvideo%2Bbestaudio HTTP/1.0" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 377, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 212, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/user/app/./server.py", line 23, in api_dl
    first_chunk = await stream.__anext__() # peek first chunk
StopAsyncIteration

I have found that this seems to happen for some audio and video combinations when using the web UI as well. For example, here is a screenshot showing the configuration I attempted to use for this video through the web UI.

image

@xcodian
Copy link
Owner

xcodian commented Jan 14, 2023

Update on this: I encountered it today for the first time! Looks like it's something to do with DASH video...? The error StopAsyncIteration is thrown whenever Google's server returns no data at all. Seems like FFMPEG just bails immediately, gets reaped and so nothing is sent back to the user.

Will investigate.

@xcodian xcodian self-assigned this Jan 14, 2023
@DavidBerdik
Copy link
Author

Thank you! I'd intended to investigate as well, but unfortunately, the project I was using this for got delayed because my life got too busy to devote time to it. Hopefully you find the solution!

@ondrejlohnisky
Copy link

I can still reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants