使用GStreamer将WAV转换为mp3(反之亦然) [英] converting wav to mp3 (and vice versa) using GStreamer

查看:203
本文介绍了使用GStreamer将WAV转换为mp3(反之亦然)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Gstreamer使用Python绑定,并正在使用以下管道将wav文件转换为mp3.在这个问题中,我使用了以下建议之一 /a>,进行了一些修改(因为使用原始语法时出现了一些错误)

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")

当我在Python中运行此代码时,没有任何错误.但是,它不会生成music.mp3文件.

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

我还需要做什么,以便它创建一个新文件music.mp3

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

推荐答案

您的管道是正确的-更具体地说,您对元素和属性的选择是正确的.

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

该问题很可能是代码的另一部分.您是否已将管道设置为gst.STATE_PLAYING?

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!

这篇关于使用GStreamer将WAV转换为mp3(反之亦然)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆