Skip to content

Cross-Platform, modern and powerful stream downloader for MPD/M3U8/ISM. English/Simplified Chinese/Traditional Chinese.

License

Notifications You must be signed in to change notification settings

ex3mpli/N_m3u8DL-RE

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

N_m3u8DL-RE

A cross-platform DASH/HLS/MSS download tool that supports on-demand and live streaming (DASH/HLS).

img img img img img

If you encounter a bug, please first confirm whether the software is the latest version (if it is a Release version, it is recommended to download the latest automatic build version from the Actions page and check whether the problem has been fixed). If you confirm that the version is the latest and the problem still exists, you can go to Issues to see if anyone has encountered a related problem. If not, then ask again.


The terminal that comes with the lower version of Windows system may not support this program. Alternative solution: run it in cmder.

Arch Linux can be obtained from AUR: n-m3u8dl-re-bin, n-m3u8dl-re-git

# Install N_m3u8DL-RE distribution version on Arch Linux and its derivatives
yay -Syu n-m3u8dl-re-bin

# Install N_m3u8DL-RE development version on Arch Linux and its derivatives
yay -Syu n-m3u8dl-re-git

Command line parameters

Description:
  N_m3u8DL-RE (Beta version) 20230628

Usage:
  N_m3u8DL-RE <input> [options]

Arguments:
  <input>  Link or file

Options:
--tmp-dir <tmp-dir>                     Set temporary file storage directory
--save-dir <save-dir>                   Set output directory
--save-name <save-name>                 Set save file name
--base-url <base-url>                   Set BaseURL
--thread-count <number>                 Set number of download threads [default: 16]
--download-retry-count <number>         Number of retries when each segment download is abnormal [default: 3]
--auto-select                           Automatically select the best track of all types [default: False]
--skip-merge                            Skip merging segments [default: False]
--skip-download                         Skip downloading [default: False]
--check-segments-count                  Check whether the number of segments actually downloaded matches the expected number [default: True]
--binary-merge                          Binary merge [default: False]
--del-after-done                        Delete temporary files after completion [default: True]
--no-date-info                          Do not write date information when muxing [default: False]
--no-log Disable                        log file output [default: False]
--write-meta-json                       Whether to output json file after parsing [default: True]
--append-url-params                     Add the input URL's Params to the segment, which is useful for some websites, such as kakao.com [default: False]
-mt, --concurrent-download              Concurrently download selected audio, video and subtitles [default: False]
-H, --header <header>                   Set a specific request header for HTTP requests, for example:
                                        -H "Cookie: mycookie" -H "User-Agent: iOS"
--sub-only                              Select only subtitle tracks [default: False]
--sub-format <SRT|VTT>                  Subtitle output type [default: SRT]
--auto-subtitle-fix                     Automatically fix subtitles [default: True]
--ffmpeg-binary-path <PATH>             Full path to the ffmpeg executable program, for example C:\Tools\ffmpeg.exe
--log-level <DEBUG|ERROR|INFO|OFF|WARN> Set the log level [default: INFO]
--ui-language <en-US|zh-CN|zh-TW>       Set the UI language
--urlprocessor-args <urlprocessor-args> This string will be passed directly to the URL Processor
--key <key>                             Set the decryption key, the program calls mp4decrpyt/shaka-packager for decryption. Format:
                                        --key KID1:KEY1 --key KID2:KEY2
--key-text-file <key-text-file>         Set the key file, the program will search for the KEY from the file by KID for decryption. (Using large files is not recommended)
--decryption-binary-path <PATH>         Full path to the tool used for MP4 decryption, for example C:\Tools\mp4decrypt.exe
--use-shaka-packager Use shaka-packager instead of mp4decrypt when decrypting [default: False]
--mp4-real-time-decryption              Decrypt MP4 segments in real time [default: False]
-M, --mux-after-done <OPTIONS>          Try to mux separated audio and video after all work is done. Type "--morehelp mux-after-done" to see more details
--custom-hls-method <METHOD>            Specify HLS encryption method (AES_128|AES_128_ECB|CENC|CHACHA20|NONE|SAMPLE_AES|SAMPLE_AES_CTR|UNKNOWN)
--custom-hls-key <FILE|HEX|BASE64>      Specify HLS decryption KEY. Can be file, HEX or Base64
--custom-hls-iv <FILE|HEX|BASE64>       Specify HLS decryption IV. Can be a file, HEX or Base64
--use-system-proxy                      Use the system default proxy [default: True]
--custom-proxy <URL>                    Set the request proxy, such as http://127.0.0.1:8888
--custom-range <RANGE>                  Download only some segments. Type "--morehelp custom-range" to see details
--task-start-at <yyyyMMddHHmmss>        Tasks will not be started before this time
--live-perform-as-vod                   Download live streams on demand [default: False]
--live-real-time-merge                  Real-time merge when recording live [default: False]
--live-keep-segments                    Keep segments when recording live and enabling real-time merging [default: True]
--live-pipe-mux                         When recording live and enabling real-time merging, use pipes + ffmpeg to mix streams to TS files in real time [default: False]
--live-fix-vtt-by-audio                 Correct VTT subtitles by reading the start time of the audio file [default: False]
--live-record-limit <HH:mm:ss>          Recording time limit when recording live
--live-wait-time <SEC>                  Manually set the refresh interval of the live list
--mux-import <OPTIONS>                  Import external media files when mixing. Type "--morehelp mux-import" to see more details
-sv, --select-video <OPTIONS>           Select the video stream that meets the requirements through regular expressions. Type "--morehelp select-video" to see more details
-sa, --select-audio <OPTIONS>           Select the audio stream that meets the requirements through regular expressions. Type "--morehelp select-audio" to see more details
-ss, --select-subtitle <OPTIONS>        Select the subtitle stream that meets the requirements through regular expressions. Type "--morehelp select-subtitle" to see more details
-dv, --drop-video <OPTIONS>             Remove the video stream that meets the requirements through regular expressions.
-da, --drop-audio <OPTIONS>             Remove the audio stream that meets the requirements through regular expressions.
-ds, --drop-subtitle <OPTIONS>          Remove the subtitle stream that meets the requirements through regular expressions.
--morehelp <OPTION>                     View detailed help information for a certain option
--version                               Show version information
-?, -h, --help                          Show help and usage information
Click here to view More Help
More Help:

  --mux-after-done

When all work is done, try to mux separated audio and video. You can specify the following parameters in :separated form:

* format=FORMAT: specify the muxing container mkv, mp4
* muxer=MUXER: specify the muxing program ffmpeg, mkvmerge (default: ffmpeg)
* bin_path=PATH: specify the program path (default: automatic search)
* skip_sub=BOOL: whether to ignore subtitle files (default: false)
* keep=BOOL: whether to keep the file after muxing is completed true, false (default: false)

For example:
# Mux to mp4 container
-M format=mp4
# Use mkvmerge, automatically search for programs
-M format=mkv:muxer=mkvmerge
# Use mkvmerge, customize program path
-M format=mkv:muxer=mkvmerge:bin_path="C\:\Program Files\MKVToolNix\mkvmerge.exe"
More Help:

  --mux-import

Introduce external media files when muxing. You can specify the following parameters in : separated format:

* path=PATH: specifies the media file path
* lang=CODE: specifies the media file language code (optional)
* name=NAME: specifies the media file description information (optional)

For example:
# Import external subtitles
--mux-import path=zh-Hans.srt:lang=chi:name="Chinese (Simplified)"
# Import external audio tracks + subtitles
--mux-import path="D\:\media\atmos.m4a":lang=eng:name="English Description Audio" --mux-import path="D\:\media\eng.vtt":lang=eng:name="English (Description)"
More Help:

  --select-video

Select the video streams that meet the requirements through regular expressions. You can specify the following parameters in the form of : separators:

id=REGEX:lang=REGEX:name=REGEX:codec=REGEX:res=REGEX:frame=REGEX
segsMin=number:segsMax=number:ch=REGEX:range=REGEX:url=REGEX
plistDurMin=hms:plistDurMax=hms:for=FOR

* for=FOR: selection method. best[number], worst[number], all (default: best)

For example:
# Select the best video
-sv best
# Select 4K+HEVC video
-sv res="3840*":codec=hvc1:for=best
# Select videos longer than 1 hour 20 minutes 30 seconds
-sv plistDurMin="1h20m30s":for=best
More Help:

  --select-audio

Select audio streams that meet the requirements through regular expressions. See --select-video

Example:
# Select all audio
-sa all
# Select the best English audio track
-sa lang=en:for=best
# Select the best 2 English (or Japanese) audio tracks
-sa lang="ja|en":for=best2
More Help:

  --select-subtitle

Select subtitle streams that meet the requirements through regular expressions. Refer to --select-video

For example:
# Select all subtitles
-ss all
# Select all subtitles with "Chinese"
-ss name="Chinese":for=all
More Help:

  --custom-range

When downloading on-demand content, only some segments are downloaded.

For example:
# Download [0,10], a total of 11 segments
--custom-range 0-10
# Download subsequent segments starting from sequence number 10
--custom-range 10-
# Download the first 100 segments
--custom-range -99
# Download content from the 5th minute to the 20th minute
--custom-range 05:00-20:00

Run screenshot

On-demand

RE1

You can also download in parallel + automatically mix streams

RE2

Live

Record TS live source:

click to show gif

Recording MPD live source:

click to show gif

During the recording process, ffmpeg is used to complete the real-time mixing of audio and video.

ffmpeg -readrate 1 -i 2022-09-21_19-54-42_V.mp4 -i 2022-09-21_19-54-42_V.chi.m4a -c copy 2022-09-21_19-54-42_V.ts

In the new version (>=v0.1.5), you can try to enable live-pipe-mux instead of the above command

Special note: If the network environment is not stable enough, please do not enable live-pipe-mux. ffmpeg is responsible for reading the data in the pipe, and it is easy to lose live data in some environments

In the new version (>=v0.1.8), you can change some options of ffmpeg when live-pipe-mux by setting the environment variable RE_LIVE_PIPE_OPTIONS: nilaoda#162 (comment)

Sponsor

Buy Me A Coffee

About

Cross-Platform, modern and powerful stream downloader for MPD/M3U8/ISM. English/Simplified Chinese/Traditional Chinese.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%