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

Ability to handle http errors: retrying, logging response #64

Closed
rappongy opened this issue Apr 8, 2024 · 8 comments
Closed

Ability to handle http errors: retrying, logging response #64

rappongy opened this issue Apr 8, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@rappongy
Copy link

rappongy commented Apr 8, 2024

Hello!

Thank you for your work. I'm downloading video course for my non-programmer-friend :) And your app is helping me a lot.

But I'm facing a smal problem with HTTP request error with some audio or video fragments. I'm not entirely sure what causes them.
And I'm afraid fragments are missed because of them. So, the video and audio are out of sync.

I have encreased max-error-count a lot, so video can loaded, but it's not best workaround.

So my questions are:

  1. Are video-audio are desynced after HTTP errors?
  2. Is it possible to retry an HTTP request in case of an error?
  3. How can I see details of errored response?

My logs:

>dash-mpd-cli-windows.exe -v -v -v -o s01_06.mp4 --quality intermediate --muxer-preference mp4:vlc --max-error-count 1000 https://.../master.mpd
[0s] [>-------------------------------------------------] Fetching DASH manifest      
23:30:12  INFO Fetching the DASH manifest
23:30:13  INFO DASH manifest has 1 period
23:30:13  INFO Streams in period #1, duration 3612.067s:
23:30:13  INFO   audio mp4a.40.2         |   127 Kbps |    lang=? label=Unknown
23:30:13  INFO   video avc1.4D401F       |  2194 Kbps |  1280x720
23:30:13  INFO   video avc1.640028       |  3113 Kbps | 1920x1080
23:30:13  INFO   video avc1.4D401E       |   803 Kbps |   640x360
23:30:13  INFO   video avc1.4D401F       |  1227 Kbps |   852x480
23:30:13  INFO Preparing download for period #1
23:30:13  INFO   Using Representation>SegmentList addressing mode for audio representation
23:30:13  INFO   Using Representation>SegmentList addressing mode for video representation
23:30:13  INFO   Audio stream selected: bw=127 Kbps lang=? codec=mp4a.40.2
23:30:13  INFO   Video stream selected: bw=2194 Kbps resolution=1280x720 codec=avc1.4D401F
23:30:14  INFO Period #1: fetching 905 audio, 905 video and 0 subtitle segments

...

23:42:13 ERROR error sending request for url (https://...) fetching video segment https://...

...

23:43:30  INFO   Wrote 287.3MB to DASH video file (0.6 MB/s)
[13m] [#################################################>] Muxing audio and video    
23:43:30  INFO   Muxing audio and video streams
23:43:30  INFO   Muxer preference for mp4 is ["vlc"]
23:43:30  INFO   Trying muxer vlc
23:43:35  INFO   Muxing with vlc subprocess succeeded
23:43:35  INFO   Wrote 55.1MB to media file
[13m] [##################################################] Done
@emarsden
Copy link
Owner

emarsden commented Apr 8, 2024

dash-mpd-cli should be retrying network requests that suffer a "transient" failure. Transient errors include timeouts and specific HTTP error codes like REQUEST_TIMEOUT, TOO_MANY_REQUESTS, SERVICE_UNAVAILABLE, GATEWAY_TIMEOUT. These errors do not count towards the max-error-count.

Presumably your errors are not being recognized as transient. I can't tell you anything more from the log you have. Are you using the latest release? The latest version should report more information concerning network errors, which might be helpful.

I don't know enough to give a full answer to your question on desyncing. Fragments should contain timestamps, and the muxer should be able to resync. You might want to try other muxers than VLC, like ffmpeg our MP4Box, which might give better results.

@rappongy
Copy link
Author

rappongy commented Apr 9, 2024

Thanks for response.

I'm using dash-mpd-cli 0.2.16.
My errors count within max-error-count. What about extended http error logs?

And I will try other codecs, nice idea.

Right now each download attempt ends with different quality results, sometime only audio available, sometimes - only video. Depends on which fragments was missed.

@rappongy
Copy link
Author

rappongy commented Apr 9, 2024

And also it will be nice if you will add option to retry errored requests :)

@rappongy
Copy link
Author

rappongy commented Apr 9, 2024

Looks like I've found best options for me :) I added sleep-requests=1 and errors stopped appearing.

Can you add ability to use float values for that options? Like 0.5.
error: invalid value '0.5' for '--sleep-requests <SECONDS>': invalid digit found in string

@rappongy
Copy link
Author

rappongy commented Apr 9, 2024

Also I've figured out that mixer-preferences=mp4:ffmpeg handles desync problem.
I have tried avi:ffmpeg, mp4:vlc, mpd:mp4box, they didn't help

@rappongy
Copy link
Author

rappongy commented Apr 9, 2024

In the end I think features that I've mentioned are useful:

  • retrying erroneous requests.
  • float values for sleep-requests.
  • detailed log of erroneous responses.

@emarsden
Copy link
Owner

Understood, thanks for the feedback. I should be able to implement these in future versions.

@emarsden emarsden added the enhancement New feature or request label Apr 11, 2024
@emarsden
Copy link
Owner

Please try the latest release, v0.2.17, which should do segment retries and more detailed error logging.

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

No branches or pull requests

3 participants
@emarsden @rappongy and others