-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PIPE to FFMPEG? #162
Comments
yes, i would also appreciate it if it could redirect the output to a unix pipe!! |
@nilaoda how to use live pipe options? |
For example:
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 On Linux, If you only want it to take effect on a specific command line:
|
@nilaoda Very thanks! |
I noticed that in this mode, temporary files are not deleted after completion. The folder remains 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 |
@Shporterator have you figured this out? noticed this too |
No. |
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 |
Problem remains |
@Shporterator Then there's nothing I can do. 🫠 |
Very sad |
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 FFMPEG ffmpeg.exe |
How can I contact you? |
Telegram: @cursoryapp_uy
|
Now working grate no jittler or audio loss or stuck, perfect!! thanks! |
To me the problem seems to be the output 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 |
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 ? |
Latest Actions version supported |
@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. |
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 |
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... |
How did you fix this problem? |
i compiled the changes what @alphalneo said. This Script works for me with TVHeadend Server:
In TVheadend add the MUX: |
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 MPD Dash is not DRM Protected in my example. You should be able to try it. |
Hi again, 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:
chmod +x /var/www/html/stream-10.sh Tvheadend mux:
|
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 '; 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? |
@matthias1232 tried your command, but not working and seems like the app is not writing anything to the pipe or call ffmpeg. Additionally, I also unable to find any muxed mpegts file. What I can found is the app downloading each segments in a directory and only muxing the segments once download completed. |
@lutfijw https://github.com/matthias1232/N_m3u8DL-RE/releases https://github.com/matthias1232/N_m3u8DL-RE/commits/main/
And in tvheadend i run the script with: (must be executable for the tvheadend user, usually user hts) You need to map your created mux first as Service and run from there. I guess there is a bug or something with tvheadend because running the mux directly fails) Its running very stable, only in the beginning after 5 Seconds i have sometimes a stucking picture for under 1 second but then everything works as expected. Dont forget to install mp4decrypt otherwhise it will not work. just execute /var/www/html/orfon-1.sh If nothing happens you can temporary enable all logging features again in the code and check your errors. Also note that your executing user needs write permissions to all the folders in the script! Btw this example code will not work for you with this TV Channel because i changed the decryption keys before posting here. If you work with your own appliaction you can also try around with the "pipe:1" setting and change the value to another one which maybe then works for you. If everything works, putty should play the pipe directly in the shell. Putty will crash but in that Moment you know everything works. Just reopen another session, disable all loggings again and then all is set for you application. And yes i know this solution is not perfect but i have not found a better way for a stable tvheadend setup. Regards |
Thats awsome! How and did you by any chance have a solution for the changing encryption keys? Is there any software that is capable of automatically fetching the keys? Thanks!! |
That is awesome @matthias1232 , let me try your script. I am also planning to restream using tvHeadend just like what you did. Will try and report back to you tomorrow. |
@Technerd-SG Changing Keys is also the reason why i created a bash script for every channel, because if you always change the mux directly in TVHeadend with the new keys, the Channel mapping will get lost. How to get the decryption keys: You will also find the guide there in the videohelp Forum how to request the decryption keys with pywidevine from the license Server of the TV Channel provider. And of course to automate it you need to reverse engineer the API from your provider you want to use to use. There are some Kodi Projects on Github for simplitv, waipu, etc. where you can see how they did that. You only need to modifiy the code to get it working without Kodi. Instead of using Kodi you need to change the parts of the code and replace it with your own code to obtain the pssh keys and request the decryption keys with pywidevine from the license Server with your .wvd file in the post command. |
Ok got it. I already have the .wcd file (also from Android Studio) and I was able with a Browserextention to get the keys manually from the ORF-ON Site (I'm from Austria) and I was able to write a NodeJS script that provides an emtpy rtsp stream and listens and when someone wants to stream the rtsp stream it uses the decryption keys that I extracted bevorehand to decrypt the stream and stream to Jellyfin. But I didn't know how to automate the key extraction part xd |
@Technerd-SG You need to develop in Austria. They use geoblocking with cloudflare for most of the Programm they stream and also block Datacenter IPs. If you decrypt with the wrong ip, the keys will not work. |
Hi @matthias1232 ,
Error shown in tvHeadend is as follow: I did check whether ffmpeg got triggered using ps -aux, but no ffmpeg triggered. Additionally, I tried to change the "pipe:1" command to stream the mux to my RTMP server but again seem no call been made. I also find the save directory is always empty while the temp directory fill with many m4s segments. I am not sure whether the live-pipe-mux is doing the job. Do you have telegram? Can you contact me at @P4nj183 |
and in tvheadend you need to add the file like that: |
And yes to come back to the issue When you play the stream with —live-take-count 2 you will have the best performance and stability with tvheadend, but always after the first played segments the stream reloads and stucks a second and then resumes normaly for hours or days without any problem. |
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?
The text was updated successfully, but these errors were encountered: