With most online streams, decent ones at least you can choose the quality. The stream quality is mostly bit rate and resolution based. Lowering the resolution means you can lower the bit rate significantly and less bit rate means less data being transferred thus allowing slower or congested networks able to stream.
To get a stream or video sources information you use
ffmpeg -i "input"
This will return all types of information from bit rate, fps, codec, resolution, duration, audio information and subtitles.
But for this post we are interested in the “streams” section, its at the bottom of the returned output and looks like this:
Stream #0:0 references the stream. In this case its a data stream of some type (timed_id3). The Streams can be video, audio, subtitle, information, metadata or some other facet.
You can see the video streams here because they say
Video: it lists the codec, resolution, ratio, fps and time bases.
Audio: as you see details. Mostly the audio wont change as the video does.
Lets say we want to get the 360p video. This is
Stream #0:10 we will also pair it with the respective Audio stream which is
Stream #0:11 essentialy to represent this selection in FFmpeg use -map the command would look like this:
ffmpeg -i "https://inputurlstream.m3u8" -map 0:10 -map 0:11 -c copy small_output.mp4
The -map command references the stream id.