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

Fetch audio and video without muxing #25

Closed
sleepycatcoding opened this issue May 12, 2023 · 5 comments
Closed

Fetch audio and video without muxing #25

sleepycatcoding opened this issue May 12, 2023 · 5 comments

Comments

@sleepycatcoding
Copy link
Contributor

Is there a way to download video and audio without muxing them into one file? I would like to have them as separate files.

@sleepycatcoding
Copy link
Contributor Author

Actually I found a way to accomplish this by using audio_only() and video_only(), but this requires two requests to the manifest file. I do not know if reqwest caches requests to the same file.

@emarsden
Copy link
Owner

You can use DashDownloader::new(url).keep_audio().keep_video(). This doesn't in fact disable the muxing step but will keep the audio and video as separate files (assuming they are separate content streams).

@sleepycatcoding
Copy link
Contributor Author

sleepycatcoding commented May 12, 2023

You can use DashDownloader::new(url).keep_audio().keep_video(). This doesn't in fact disable the muxing step but will keep the audio and video as separate files (assuming they are separate content streams).

If I were to use keep_audio() and keep_video(), is there a way to fetch paths to the files?

EDIT:

Seems the paths are only printed to stdout.

dash-mpd-rs/src/fetch.rs

Lines 2048 to 2057 in 2135788

if downloader.keep_audio {
println!("Audio stream kept in file {tmppath_audio}");
} else if fs::remove_file(tmppath_audio).is_err() {
log::info!("Failed to delete temporary file for audio segments");
}
if downloader.keep_video {
println!("Video stream kept in file {tmppath_video}");
} else if fs::remove_file(tmppath_video).is_err() {
log::info!("Failed to delete temporary file for video segments");
}

@emarsden
Copy link
Owner

Indeed, there's no API to retrieve that information. Perhaps it would be better to change the interface to something like keep_audio_as(audio-pathname) .

@sleepycatcoding
Copy link
Contributor Author

Indeed, there's no API to retrieve that information. Perhaps it would be better to change the interface to something like keep_audio_as(audio-pathname) .

Created a draft PR for this: #26.

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

2 participants