Download ONLY audio from streaming video?

I understand that I can make a range request to load a specific time range for streaming web video.

I am wondering now if you can only request MP3 or AAC audio stream from a video, so on my server I will upload only audio.

From what I heard, it’s possible, but I have not yet found a legal solution or method for this on the Internet, so I don’t know where to start.

+4
source share
1 answer

Assuming you're talking about streams over HTTP, this is not real. I would not even recommend trying it if you do not have special needs and have a lot of time on your hands.

Is it possible? May be. First, you must have an HTTP server that supports range requests. If so, you should know something about the format of the container. To do this, you need to start downloading the file and identify it.

Most containers interleave threads together. That is, you will have a piece of bytes for video, a piece of bytes for audio and fragments for any other streams. For demonstration purposes, suppose that a video has only an audio stream and a video stream, and each fragment contains 1 second. The interleaving is as follows:

HEADERS AVAVAVAVAVAVAV ...

HEADERS is all that a container has to set up a stream. A is a fragment of an audio stream, and V is a fragment of a video stream.

If you want to load only one stream, you must analyze this container format yourself, load the container headers and any other data needed for the container, and then make range requests for all blocks of the specific stream you want. Depending on the rotation, in the end, it can be completely ineffective!

When you upload your data, you need to write it back to a file that you can actually use, which means you will probably need to write some custom code for this, or trick FFMPEG by writing it for you.

+6
source

All Articles