User Tools

Site Tools


tech:streamlink

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tech:streamlink [2022/03/24 00:23] – created katsimbristech:streamlink [2025/10/20 18:48] (current) – Add local example to "How to download and combine m3u8 files" katsimbris
Line 2: Line 2:
 ===== How to download an m3u8 file ===== ===== How to download an m3u8 file =====
 <code>$ streamlink -o "input.mp4" https://example.m3u8 720p</code> <code>$ streamlink -o "input.mp4" https://example.m3u8 720p</code>
 +===== How to download and combine m3u8 files =====
 +Use this when trying to download one file (usually through Streamlink) only gives you segments of the whole file. I came across this code because of getting shortened files from Nebula.
 +<code>$ ffmpeg -i "video_example.m3u8" -i "audio_example.m3u8" \
 +  -c copy -map 0:v:0 -map 1:a:0 output.mp4</code>
 +or
 +<code>$ ffmpeg -i video.mp4 -i audio.mp4 -c copy -map 0:v:0 -map 1:a:0 output.mp4</code>
 ===== How to encode downloaded file ===== ===== How to encode downloaded file =====
 <code>$ ffmpeg -i input.mp4 output.mkv</code> <code>$ ffmpeg -i input.mp4 output.mkv</code>
 +===== How to encode and change resolution =====
 +<code>ffmpeg -i 01.mp4 -vf "scale=1280:720" output.mkv</code>
 +<code>ffmpeg -i MyMovie.mkv -vf scale=-1:720 -c:v libx264 -crf 0 -preset veryslow -c:a copy MyMovie_720p.mkv</code>
 +<code>ffmpeg -i MyMovie.mkv -vf scale=-1:720 -c:v libx264 -crf 51 -preset veryslow -c:a copy MyMovie_720p.mkv</code>
  
 +The scale video filter is for resizing the video. You just set one size – which is the height in this example – and use -1 for the other dimension. ffmpeg will recalculate the correct value automatically while preserving the aspect ratio. \\
 +\\
 +Quality controlled with the -crf option:\\
 +\\
 +The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless or nearly so: it should look the same or nearly the same as the input but it isn't technically lossless.
 +
 +The range is exponential, so increasing the CRF value +6 is roughly half the bitrate while -6 is roughly twice the bitrate. General usage is to choose the highest CRF value that still provides an acceptable quality. If the output looks good, then try a higher value and if it looks bad then choose a lower value.\\ \\
 +You control the tradeoff between video encoding speed and compression efficiency with the -preset options. Those are ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow. Default is medium. The veryslow option offers the best compression efficiency (resulting in a smaller file size for the same quality) but it is very slow – as the name says.
 +\\
 +\\
 +The audio will be stream copied directly from the input file to the output file without any changes.
tech/streamlink.1648081405.txt.gz · Last modified: by katsimbris