converting wav to mp3 (and vice versa) using GStreamer

℡╲_俬逩灬. 提交于 2019-12-21 22:48:09

问题


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


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/2172000/converting-wav-to-mp3-and-vice-versa-using-gstreamer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!