Hi
I'm trying to record a piece of a DASH stream that's clearkey encrypted using ffmpeg. However, when running the command the output is very bad. First two seconds is video only, no audio then the video stops but the timeline keeps running until audio is heard but image remains frozen and so on. If I skip manually in the timeline on VLC it will sometimes play audio (when otherwise it wouldn't have played it if passing through it organically).
I believe this is a timing issue but I tried:
1. Different flags to force new timestamps (this fixed the time counter on VLC not working, it now works but video output is the same)
2. Downloading only video or only audio
3. Re-encoding and remuxing
All I do yields the same issue. The video, of course, is played flawlessly in the browser. Any ideas as to how to proceed?
PHP Code:ffmpeg \
-cenc_decryption_key [key]\
-i [url].../index.mpd \
-map 0:v:2 \
-map 0:a:2 \
output.mp4
+ Reply to Thread
Results 1 to 12 of 12
-
-
Streamlink does sound like what I need but it doesn't support DRM unfortunately. I've seen two forks that may but one of them is Windows only (will try later with a VM if I don't find an alternative) and the other one is unmaintaned and unbuildable because of dependency issues
-
Yeah I forgot the DRM part, N_m3u8DL-RE can handle live streams and can be combined with shaka packager or mp4decrypt. Or DDownloader
-
-
I'm trying to do something like what is described in https://github.com/nilaoda/N_m3u8DL-RE/issues/631
I was successfully able to use N_m3u8DL-RE to output to a growing file and basically stream that with the caveat that streaming it with ffmpeg means that whoever connects to it will play from the start thus not being an actual livestream.
I have not been able to download to a FIFO pipe (therefore keeping just the last info) and doesn't look like it's supported. If I create the pipe and try to make the binary use it by modifying --save-dir and --save-name, it gets ignored and instead a new file is created.
As pointed by @LZAA ffmpeg will not work (or maybe I don't have the right command for it). I'm very close but unfortunately no dice yet. -
Hmm If you're outputting to a growing file it will start from the beginning of the file when you access it so saving to "output.mp4" is not gonna provide your desired result.
How come you can't download to a pipe? You could send the decrypted N_m3u8DL-RE stream to "-o /tmp/mypipe" and then open that with "ffmpeg -i /tmp/mypipe". Alternatively maybe the "-stream_loop" option in ffmpeg can be used. Failing that maybe file a bug report with ffmpeg. -
Unless I'm missing something, N_m3u8DL-RE does not have an "-o" option. You can tell it the save path and the name of the file you want as I mentioned in my previous reply but if I do that it will see that there's a file already with that name and then use a different name (probably to avoid overwriting which I can't tell if it's possible to disable)
-
Yeah my bad, I'm getting mixed up with yt-dlp. There was a thread recently, @Oldfart1234 provided a detailed answer in there and there are a few options you could try playing with " --live-real-time-merge --live-pipe-mux --mp4-real-time-decryption"
Surely there must be a way to do it, it's only piping a stream after all. -
Small update: I was able to do it.
I don't know why my file was being avoided but I tried today from scratch and it worked. Summary:
1. Create a FIFO pipe
2. Oen an UDP stream from the FIFO pipe. There's a timing issue, I think, since if you don't open the stream before starting the download via N_m3u8DL-RE you cannot open it later or it just doesn't show anything... it's more straightforward this way.
2. Run the N_m3u8DL-RE with "--live-pipe-mux true" and "--save-dir" and "save-name" (the last one with no extension)
That should do it. Opening it in VLC works normally, some stutter here and there which may be due to UDP's nature or just artifacts from the original stream but it's 99.9% usable and performant. Delay is like 10 or 11 seconds from the original stream which is not great but not terrible. I have not tried to optimize this yet. If anyone know how to do this I'd appreciate you sharing the knowledge
as far as I know I'm doing no re-encoding or anything like that in my last step with ffmpeg so I can't really pinpoint why the delay is happening.
I tried removing -re which reduced slightly the delay (within error margins so nothing significant) and the experience was noticeably worse so it's not worth it.
Similar Threads
-
Is it possible to download this dash stream?
By sarksi_yol1 in forum Video Streaming DownloadingReplies: 10Last Post: 22nd Feb 2024, 02:50 -
How to get playready dash stream into ffmpeg?
By Chris91 in forum Video Streaming DownloadingReplies: 2Last Post: 17th Jun 2023, 16:49 -
Play downloaded dash (protected but key given) back with VLC?
By adidaz in forum Video Streaming DownloadingReplies: 6Last Post: 27th Mar 2022, 13:57 -
Newbie: How to download what I think is MPEG-DASH stream
By charlie3629 in forum Video Streaming DownloadingReplies: 13Last Post: 5th Nov 2021, 05:51 -
Audio out of sync after downloaded MPEG dash video
By kfiroflwp in forum Newbie / General discussionsReplies: 3Last Post: 29th Jan 2021, 14:30


Quote