How do I use gstreamer to make an audio clip from a segment of a longer source?

烈酒焚心 提交于 2019-12-21 20:49:42

问题


I would like to use gstreamer to save an arbitrary clip from one audio file to a new file. For example, a segment from 1 minute to 2 minutes in the original. How do I do it?


回答1:


You need gnonlin. See http://www.jonobacon.org/2006/12/27/using-gnonlin-with-gstreamer-and-python/

You won't need a gnlcomposition because you only want one segment. Use a gnlfilesource with its start and duration set to 0, 1 minute, and media-start and media-duration set to 1 minute, 1 minute. All times and durations are in nanoseconds.

Take 5 seconds from source.mp3 starting at 10 seconds, write to destination.ogg:

gst-launch-0.10 gnlfilesource location=$PWD/source.mp3 \
start=0 duration=5000000000 media-start=10000000000 media-duration=5000000000 ! \
audioconvert ! vorbisenc ! oggmux ! filesink location=destination.ogg


来源:https://stackoverflow.com/questions/2215683/how-do-i-use-gstreamer-to-make-an-audio-clip-from-a-segment-of-a-longer-source

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