Open dromicron opened 1 year ago
yes, i would also appreciate it if it could redirect the output to a unix pipe!!
@nilaoda how to use live pipe options?
@nilaoda how to use live pipe options?
For example:
set RE_LIVE_PIPE_OPTIONS="-c copy -f flv rtmp://your-streaming-server-url/your-stream-key"
N_m3u8DL-RE.exe --live-real-time-merge --live-pipe-mux "http://path/to/a.mpd"
This will change the command line used for mixing streams and output it to the server you specify. You can also output it as HLS segments by set specific value of RE_LIVE_PIPE_OPTIONS
.
On Linux, If you only want it to take effect on a specific command line:
RE_LIVE_PIPE_OPTIONS="..." ./N_m3u8DL-RE ...
@nilaoda Very thanks!
I noticed that in this mode, temporary files are not deleted after completion. The folder remains The command looks like this. Maybe I did something wrong?
RE_LIVE_PIPE_OPTIONS="-c copy -f mpegts pipe:1" /home/N_m3u8DL-RE --log-level off --tmp-dir /tmp --no-log --ffmpeg-binary-path /home/ffmpeg --decryption-binary-path /home/mp4decrypt --key 0:0 "$URL" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" --del-after-done true --mp4-real-time-decryption true --live-keep-segments false --live-real-time-merge true --live-pipe-mux true --thread-count 3 -sv best -sa all
And I also noticed that errors in the image periodically freezes if you use this method. I can't figure out what this is related to yet. I tried different versions of ffmpeg, the result is the same
I noticed that in this mode, temporary files are not deleted after completion.
@Shporterator have you figured this out? noticed this too
have you figured this out?
No. Do you have any problems with the video when using this method?
And I also noticed that errors in the image periodically freezes if you use this method.
what do you mean by periodically freezes? the stream/pipe stops?
what do you mean by periodically freezes? the stream/pipe stops?
During the loading of new fragments, the image stops for a few seconds, the sound continues to work normally.
I think that happens to me too... the video fragment loads way slower (pauses for a moment) than the audio
You can try set a smaller value for --live-wait-time
You can try set a smaller value for
--live-wait-time
Problem remains
@Shporterator Then there's nothing I can do. 🫠
Then there's nothing I can do.
Very sad
Then there's nothing I can do.
This problem is absolutely with any streams, which makes this new feature useless:(
Then there's nothing I can do.
This problem is absolutely with any streams, which makes this new feature useless:(
Yep i have the same problem, fo now just do this, maybe you do the same as me for now
N_m3u8DL-RE.exe --save-dir stream --del-after-done true --save-name tNoticias --tmp-dir temp "url" --live-real-time-merge true --live-wait-time 5 --mp4-real-time-decryption true --live-pipe-mux -sv best -sa all --key xxxxxxxxxx:xxxxxxxxx --use-system-proxy true --custom-proxy http://xxx.xxxx.xxx.xxx:3128
FFMPEG
ffmpeg.exe -re -i stream/tNoticias.ts -c copy -f hls -hls_time 5 -hls_list_size 4 -hls_flags delete_segments C:/wamp64/www/bin/m3u8/tNoticias.m3u8
Yep i have the same problem, fo now just do this, maybe you do the same as me for now
How can I contact you?
Telegram: @cursoryapp_uy
Yep i have the same problem, fo now just do this, maybe you do the same as me for now
How can I contact you?
Now working grate no jittler or audio loss or stuck, perfect!! thanks!
To me the problem seems to be the output Vid 1920x1080 | 5499 Kbps | 50 00m38s/00m55s 16/23 Recording 69% 0.00Bps(1) ⣟ Aud 129 Kbps | ita | 2CH 00m38s/00m55s 16/23 Recording 69% 0.00Bps(1) ⣯ Can we suppress easily?
Edited: Yes I confirmed, I changed pipe:1 to pipe:2 I sent the stdout to dev null and finally I resent stderr to stdout and evrything is working!!! Therefore is the contamination of the std out that create the problem
To me the problem seems to be the output Vid 1920x1080 | 5499 Kbps | 50 00m38s/00m55s 16/23 Recording 69% 0.00Bps(1) ⣟ Aud 129 Kbps | ita | 2CH 00m38s/00m55s 16/23 Recording 69% 0.00Bps(1) ⣯ Can we suppress easily?
Edited: Yes I confirmed, I changed pipe:1 to pipe:2 I sent the stdout to dev null and finally I resent stderr to stdout and evrything is working!!! Therefore is the contamination of the std out that create the problem
Could you share the full command that you used to make this work?
Sure, I am using linux
RE_LIVE_PIPE_OPTIONS="-c copy -f mpegts pipe:2" /MYPATH/N_m3u8DL-RE --log-level off --no-date-info --no-log True THEURLOFYOURSTREAM --del-after-done true --mp4-real-time-decryption true --live-keep-segments false --live-real-time-merge true --live-pipe-mux true --thread-count 3 -sv best -sa all --concurrent-download --save-dir pippo_FOLDER 2>&1 >/dev/null
The output is N_m3u8DL-RE is done on STDERR, I am sending the SDTOUT to a devnull and I am sending the STDERR to STDOUT
Waiting for a solution, for now I solved in this way
modify this line
var progress = AnsiConsole.Progress().AutoClear(true);
which you can find in 3 files
with this
var progress = AnsiConsole.Progress().AutoClear(true).AutoRefresh( DownloaderConfig.MyOptions.LogLevel != LogLevel.OFF );
Thank you!
@nilaoda is it possible to change the pipe file location (RE_pipe_dc3a37d4-9ef7-482f-975a-e6a6fa6579bf) to another folder instead of /tmp ?
@nilaoda is it possible to change the pipe file location (RE_pipe_dc3a37d4-9ef7-482f-975a-e6a6fa6579bf) to another folder instead of /tmp ?
Latest Actions version supported RE_LIVE_PIPE_TMP_DIR
environment var.
@nilaoda It still creates to the default /tmp after setting the new path per example: /tmp/ramdisk
Not sure if I'm doing something wrong.
@JohnTrabusca
RE_LIVE_PIPE_TMP_DIR="/data/my_temp" ./N_m3u8DL-RE xxx
After setting and doing a stat to that file (RE_pipe) in the given path in logs, it cannot be found.
Hello. There is such a link mpd...
The program N_m3u8DL-RE 0.2.0 Beta normally downloads temporary video mp4 files 142 pieces (each size 10.0 MB), adds the disputed one 143 piece and the last one has a file size of 1.5 GB. Collect together the mp4 files have a size of - 2.11 GB with a duration of 01:15:38, although it should be 1.39 GB with a duration of 00:49:59 (only the video without sound and subtitles)
Here are the options available on the command line - N_m3u8DL-RE "%mpd%" --check-segments-count:false --save-name "02" --key 7d91116c8f0b95b8db4953f1f26e6aa2:5a4491ef67bc263c0 125c5914322dfba
yt-dlp - this program load normally video size 1.39 GB
There is a problem with this option RE_LIVE_PIPE_TMP_DIR="/tmp/channel", the pipe file keeps being created in the /tmp/ folder and N_m3u8DL-RE looks for that file in /tmp/channel/, that's why it gives an error /tmp/channel/RE_pipe_f2eee6bf-6068-43aa-b36a-ac8bca0e5677: No such file or directory
I have the same problem I sovled it like so:
streamlink "http://stream.example/manifest.mpd" best --ffmpeg-dkey "123456789abcdefghijklmnopqrstuvwx" --stdout | ffmpeg -re -i pipe:0 -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -f flv rtmp://server.ip/stream1/stream
the normal streamlink software doesnt support this you would need to use: "https://github.com/sunghome/streamlink_optionalkey". This is not a good solution... Please implement a pipe function!...
Now working grate no jittler or audio loss or stuck, perfect!! thanks!
How did you fix this problem?
i compiled the changes what @alphalneo said. https://github.com/matthias1232/N_m3u8DL-RE/releases/tag/1.0
This Script works for me with TVHeadend Server:
#!/bin/sh
rm /var/www/html/tv/yourchannel/temp -rf
export RE_LIVE_PIPE_OPTIONS="-c copy -f mpegts pipe:2"
./N_m3u8DL-RE --log-level off --no-date-info --no-log True --key yourkey1 --key yourkey2 https://example.com/manifest.mpd --del-after-done true --mp4-real-time-decryption true --live-keep-segments false --live-real-time-merge true --live-pipe-mux true --thread-count 3 -sv best -sa all --concurrent-download --tmp-dir /var/www/html/tv/yourchannel/temp --save-dir /var/www/html/tv/yourchannel/temp --save-name temp 2>&1 >/dev/null
pid=$!
# If this script is killed, kill the `N_m3u8DL-RE'.
#trap "kill $pid 2> /dev/null" EXIT
# While N_m3u8DL-RE is running...
while kill -0 $pid 2> /dev/null; do
find /var/www/html/tv/yourchannel/temp -mmin +1 -type f -exec rm -fv {} \;
sleep 1
done
# Disable the trap on a normal exit.
In TVheadend add the MUX: pipe:///var/www/html/tv/yourchannel/stream.sh
I got it working now without any problems with Jitter, Stream Stucking lost Packets etc.... but the initial stream loading Time is incredibly slow now. The Stream Start Takes around 10-15 Seconds now. Maybe we can reduce the time to a Minimum, any ideas?
#!/bin/sh
rm /var/www/html/temp/1 -rf
mkdir /var/www/html/temp/1 -p
export RE_LIVE_PIPE_OPTIONS="-movflags faststart -loglevel error -map 0 -c:a copy -c:v copy -c:s copy -f mpegts -y pipe:"
/opt/N_m3u8DL-RE_Beta_linux-arm64/N_m3u8DL-RE --header "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" https://orf3-247.mdn.ors.at/orf/orf3/qxa-247/manifest.mpd -no-log true --use-ffmpeg-concat-demuxer false --no-date-info false --live-real-time-merge true --live-pipe-mux true --save-dir /var/www/html/temp/1 --tmp-dir /var/www/html/temp/1 --check-segments-count false --live-fix-vtt-by-audio true --mp4-real-time-decryption true --skip-merge false --del-after-done true --save-name temp -mt TRUE --thread-count 16 --auto-select --live-take-count 4 --live-wait-time 9 -M format=mp4:muxer=ffmpeg | ffmpeg -loglevel fatal -i pipe:0 -map 0 -c:a copy -c:v copy -c:s copy -mpegts_service_type advanced_codec_digital_hdtv -f mpegts -y pipe:1
The MPD Dash is not DRM Protected in my example. You should be able to try it.
Hi again, i made a new Version of N_m3u8DL-RE. This should fix the issues with livestreams. I disabled the ffmpeg -re feature, so pipe will send out the first segments directly to the clients, and then stream as usual when new segments are downloaded. i also added ffmpeg options: -rtbufsize 1G -y -max_interleave_delta 100M -fflags +fastseek+ignidx+discardcorrupt+shortest+genpts
https://github.com/matthias1232/N_m3u8DL-RE/releases/tag/1.8
Im not sure if my version breaks other features, but my purpose is livestreams with TVHeadend, and this works well now.
A working script for tvheadend could look like this:
!/bin/sh
rm /var/www/html/temp/1 -rf rm /var/www/html/save/1 -rf mkdir /var/www/html/temp/1 -p mkdir /var/www/html/save/1 -p export RE_LIVE_PIPE_OPTIONS="-dn -drop_pkts_on_overflow 1 -attempt_recovery 1 -recover_any_error 1 -map_metadata:g 1:g -loglevel quiet -mpegts_service_type advanced_codec_digital_hdtv -protocol_whitelist pipe,file,http,https,tcp,tls,crypto -f mpegts -protocol_whitelist pipe,file,http,https,tcp,tls,crypto -movflags +delay_moov+default_base_moof+cmaf+frag_every_frame+separate_moof+rtphint+omit_tfhd_offset -rtpflags +h264_mode0 pipe:1" /opt/N_m3u8DL-RE_Beta_linux-arm64/N_m3u8DL-RE /opt/N_m3u8DL-RE_Beta_linux-arm64/N_m3u8DL-RE --header "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" --key xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxx --key xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxx https://orf1-247.mdn.ors.at/orf/orf1/drmqxa-247/manifest.mpd --save-dir /var/www/html/save/1 --save-name temp --tmp-dir /var/www/html/temp/1 --auto-subtitle-fix true --live-fix-vtt-by-audio true --mp4-real-time-decryption true --use-ffmpeg-concat-demuxer true --no-date-info --download-retry-count 0 --check-segments-count true --live-real-time-merge false --live-keep-segments false --auto-select --live-take-count 3 --force-ansi-console false --del-after-done false --no-log --log-level OFF --live-pipe-mux true
chmod +x /var/www/html/stream-10.sh
Tvheadend mux:
pipe:///var/www/html/stream-10.sh
Hello, I am trying to decrypt an MPD source and push it to RTMP using the following command:
export RE_LIVE_PIPE_OPTIONS=' -c copy -f flv rtmp://ip:port/live/test_turk ';
N_m3u8DL-RE 'url' --key 'key:key' --use-shaka-packager true --ffmpeg-binary-path /bin/ffmpeg --decryption-binary-path bin/packager-linux-x64 --del-after-done true --mp4-real-time-decryption true --live-keep-segments false --binary-merge --live-pipe-mux true --thread-count 5 --use-ffmpeg-concat-demuxer --auto-select --save-name 10dc0e29-521b-4861-9ee8-3903015a1400
The issue I'm encountering is that the RTMP process stops unexpectedly after around 10 minutes, and I have no idea why. There is nothing in the logs that indicates what might be causing the problem.
Does anyone have any suggestions on how to troubleshoot or resolve this?
hi, i try to use pipe function but i only get .TS file it is possible to pipe to ffmpeg to make live hls output?