Today my girlfriend needed the audio from a youtube clip, so I decided to see how easy I could get it. I started by getting the flv from the clip, one useful source for that is downloadflv.com. After I had the file I verified I could actually play it, double clicking opened totem and started playing, so far so good.
Because totem managed to play I thought gstreamer should be able to open the file and I already knew gstreamer was capable of converting and after about 3 tries I came up with the following command:
gst-launch-0.10 filesrc location=file.flv ! decodebin ! audioconvert ! lame ! filesink location=file.mp3
This
- opens the file
- decodes the file (I guess this is needed to rip audio only)
- does something with audio, I don't know if you always need this but I think this is a sort of wrapper to match input with output plugins
- encodes to mp3 audio
- writes to a file
There's much more you can do with gstreamer, so if you found another one of those 'this might be useful every once or twice in five years' commands please let me know in comments.
Thursday, June 5, 2008
Subscribe to:
Post Comments (Atom)
5 comments:
what you wrote here does unnecessary encoding and re-encoding!
doing it right:
gst-launch-0.10 filesrc location=video.flv ! flvdemux ! audio/mpeg ! filesink location=out.mp3
this just demuxes the mp3 stream from the video file.
I didn't know flv uses mp3 audio, but thanks for pointing that out!
The trick of the first commenter doesn't work, however, the original post works great, thanks!
The first poster almost had it, they just needed to specify a container near the end.
gst-launch-0.10 filesrc location=video.flv ! flvdemux ! audio/mpeg ! qtmux ! filesink location=out.mp3
Post a Comment