VideoHelp Forum




+ Reply to Thread
Results 1 to 12 of 12
  1. 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]\
      -
    [url].../index.mpd \
      -
    map 0:v:\
      -
    map 0:a:\
      
    output.mp4 
    Quote Quote  
  2. 'FFmpeg' sometimes does not save the encrypted stream correctly. You won't fix it. Use another download tool.
    Quote Quote  
  3. any recommendations? the download is a proof of concept, I ultimately want to restream it to my local network so that's why I went with ffmpeg originally. Looking in the Software section I see some candidates but nothing that would allow me to re-stream unfortunately
    Quote Quote  
  4. Streamlink will do what you need
    Quote Quote  
  5. 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
    Quote Quote  
  6. Yeah I forgot the DRM part, N_m3u8DL-RE can handle live streams and can be combined with shaka packager or mp4decrypt. Or DDownloader
    Quote Quote  
  7. Originally Posted by vidsrme View Post
    Yeah I forgot the DRM part, N_m3u8DL-RE can handle live streams and can be combined with shaka packager or mp4decrypt. Or DDownloader
    does not seem like N_m3u8DL-RE is able to stream what it's receiving on a local port, is it?
    Quote Quote  
  8. 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.
    Quote Quote  
  9. 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.
    Quote Quote  
  10. Originally Posted by vidsrme View Post
    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)
    Quote Quote  
  11. Originally Posted by craftwork3562 View Post
    Unless I'm missing something, N_m3u8DL-RE does not have an "-o" option.
    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.
    Quote Quote  
  12. 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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!