StereoMatching
StereoMatching

Reputation: 5019

GStreamer split audio to multiple parts by seconds

Platform is windows 10 64bits, download prebuild gstreamer1.0 from their website.

I would like to split audio to multiple parts by gstremaer, example

audio.wav/audio.mp3/audio.ma4, their lengths are 60 seconds, I would like to split the audio.* to 10 seconds per audio, the results should be

audio0.wav~audio9.wav or audio0.mp3~audio9.mp3 or audio0.ma4~audio9.ma4

equivalent command of ffmpeg is

ffmpeg -y -i audio.wav -f segment -segment_time 10 -c copy audio%d.wav

I tried with the multifilesink of gstreamer, example

gst-launch-1.0 filesrc location=audio.mp3! multifilesink location=audio/test/test02%d.mp3 next-file=5 max-file-duration=10000000000

But this function cannot split the audio to 10 seconds length, what kind of error I commit? Thanks

Upvotes: 0

Views: 1339

Answers (1)

Florian Zwoch
Florian Zwoch

Reputation: 7403

You want to look at splitmuxsink. Check it's properties, especially muxer and max-size-time.

E.g:

gst-launch-1.0 audiotestsrc ! \
splitmuxsink location=out_%d.wav muxer=wavenc max-size-time=10000000000

Will generate 10 second long wav files.

Edit : Original command do not work, it should be

gst-launch-1.0 filesrc location=audio/audio.mp3 ! decodebin ! audioconvert ! splitmuxsink location=audio/test/out_%d.wav muxer=wavenc max-size-time=10000000000

Upvotes: 2

Related Questions