whitethorn
October 14th, 2008, 12:13 PM
Hi,
I'm trying to write a script to dload youtube videos and convert them to .mp3. So far I'm able to dload the videos and convert them. My problem is I want to keep the title of the file. So when I run
youtube-dl -l "$1"
I'd like to save the title, so whatever is in front of the .flv in a variable to I can replace it after using ffmpeg and ecasound. I've found a couple other scripts but they weren't as automated as I wanted it to be (required me to enter a file name). I'm just stuck on reading the filename and saving it as a variable.
So I think I've figure it out, but there's probably a better way of getting this done. Any suggestions would be great. Here's my script
#!/bin/bash
youtube-dl -l "$1"
a=`ls |grep flv`
mv *.flv /tmp/test.flv
ffmpeg -i /tmp/test.flv -acodec mp3 -ac 2 /tmp/test.mp3
ecasound -i /tmp/test.mp3 -etf:8 -o ~/Desktop/"${a%flv}mp3"
rm /tmp/test.mp3
rm /tmp/test.flv
I'm trying to write a script to dload youtube videos and convert them to .mp3. So far I'm able to dload the videos and convert them. My problem is I want to keep the title of the file. So when I run
youtube-dl -l "$1"
I'd like to save the title, so whatever is in front of the .flv in a variable to I can replace it after using ffmpeg and ecasound. I've found a couple other scripts but they weren't as automated as I wanted it to be (required me to enter a file name). I'm just stuck on reading the filename and saving it as a variable.
So I think I've figure it out, but there's probably a better way of getting this done. Any suggestions would be great. Here's my script
#!/bin/bash
youtube-dl -l "$1"
a=`ls |grep flv`
mv *.flv /tmp/test.flv
ffmpeg -i /tmp/test.flv -acodec mp3 -ac 2 /tmp/test.mp3
ecasound -i /tmp/test.mp3 -etf:8 -o ~/Desktop/"${a%flv}mp3"
rm /tmp/test.mp3
rm /tmp/test.flv