node-ytdl
node-ytdl copied to clipboard
Downloading video file and converting to mp3 error
I've tried to reinstall and insure correct filepath in my system environment variables for FFMPEG however every time I try to convert a YouTube link to an mp3 I'm given a "pipe:0: Invalid data found when processing input"
Any insight?
Thanks!
how exactly are you calling ffmpeg?
Same issue here. Was working fine few days ago, then got this issue "pipe:0: Invalid data found when processing input"
Tried running the given example
ytdl http://www.youtube.com/watch?v=_HSylqgVYQI | ffmpeg -i pipe:0 -b:a 192K -vn myfile.mp3
, same error.
Save to file
ytdl "http://www.youtube.com/watch?v=_HSylqgVYQI" > myvideo.mp4
, then the resulting myvideo.mp4 is corrupted and cannot be opened.
However, the other format of save to file
ytdl -o "myvideo.mp4" "http://www.youtube.com/watch?v=_HSylqgVYQI"
actually works.
So my temporary workaround
ytdl -o "myvideo.mp4" "http://www.youtube.com/watch?v=_HSylqgVYQI" ; ffmpeg -i myvideo.mp4 -b:a 192K -vn "myvideo.mp3" ; rm myvideo.mp4
package.json
"ytdl": "^1.4.1",
"ytdl-core": "^4.1.4"
🤔 can't replicate on Linux
Hi, not sure is it my configuration issue, upon further checking, it seems this issue only arise when I use Windows PowerShell to execute the commands. Running the command from normal cmd.exe and from Mac terminal is fine.
ytdl uses process.stdout.isTTY to know if the program is piping to a terminal. if that property is false, it will assume the program is being piped to another program, so will print the video output directly. in contrast, if it is piping to a terminal, then it will print a few video details plus a progress bar. which is i think is what's being printed, and then piped to ffmpeg.
so there might be some sort of incompatibility with powershell and the isTTY check
if this check can't be fixed, i could add a special output like --output=- that could instruct ytdl to pipe output directly to stdout.