I am trying to pipe youtube-dl output to ffmpeg as input, but cannot seem to get the piping part to work. In normal cmd, I can do something like
C:\YT\youtube-dl.exe -o - https://www.youtube.com/watch?v=L4aLQ0ki9Tk | ffmpeg -i pipe:0 -f asf pipe:1
but in c# this doesn't work. Currently, I have c# create 2 processes:
one for youtube-dl
C:\YT\youtube-dl.exe -o - https://www.youtube.com/watch?v=L4aLQ0ki9Tk
and another for ffmpeg
ffmpeg -i {yt.StandardOutput} -f s16le -ar 48000 -ac 2 pipe:1
The problem is with the {yt.StandardOutput}
(where yt is the process name of the youtube-dl process and -i
specifies the input file/stream). Using pipe:0 doesn't work either and I am not sure how to link the piped output of the first to the input of the second.
When doing your processing instead of starting
youtube-dl.exe
andffmpeg
as separate processes start the command shell itself from your code usingcmd.exe /C
this will allow you to use the pipe to flow the context from one program to another.