cppb
cppb

Reputation: 2409

converting wav to mp3 (and vice versa) using GStreamer

I am using Python bindings for Gstreamer and am using the following pipeline to convert a wav file to mp3. I used one of the suggestions in this question , with some modifications (as I was getting some errors when original syntax was used)

    gst.parse_launch("filesrc location=C:\\music.wav ! decodebin 
! audioconvert !  lame ! filesink location=C:\\music.mp3")

When I run this code in Python, I get no errors. However, it doesn't generate music.mp3 file.

What else do I need to do so that it creates a new file music.mp3

Upvotes: 1

Views: 4435

Answers (2)

Nowayz
Nowayz

Reputation: 1948

If you didn't get this working I suggest using ffmpeg to convert your files, it's very efficient and opensource, you can find a compiled windows version with WinFF which you can manipulate through the command line.

Upvotes: 0

Jeremiah Rose
Jeremiah Rose

Reputation: 4122

your pipeline is correct - or more specifically, your choice of elements and properties is correct.

the problem is most likely in another part of your code. have you set the pipeline to gst.STATE_PLAYING?

pipeline = gst.parse_launch("filesrc location=C:\\music.wav ! decodebin ! audioconvert !  lame ! filesink location=C:\\music.mp3")
pipeline.set_state(gst.STATE_PLAYING)

there are numerous other common mistakes that can be made- posting your entire source code would be a great help!

Upvotes: 1

Related Questions