I’m trying to convert a set of mp3s that represent chapters of an audiobook into HLS as part of a real-time streaming solution using gstreamer. While I have the code working, the main issue is that the conversion only creates one large segment per input file even if I specify 10 or 20 second segments in hlssink. Note that I'm doing this in-memory as bitstream chunks by downloading mp3 and mp4s from an application that stores the AV assets and that code is working fine for audio and video. Perhaps, I have to use another element such as splitmuxsink to manually split the files? I don’t have this problem with video. Here is the Python code fragment of my pipeline:
# Create the source element
src = Gst.ElementFactory.make('appsrc', 'source')
# Create the rest of the audio pipeline
decodebin = Gst.ElementFactory.make('decodebin')
audioconvert = Gst.ElementFactory.make('audioconvert')
avenc_aac = Gst.ElementFactory.make('avenc_aac')
mpegtsmux = Gst.ElementFactory.make('mpegtsmux')
hlssink = Gst.ElementFactory.make('hlssink')
# Create the queue element
queue = Gst.ElementFactory.make('queue')
# Set the target-duration property of hlssink
hlssink.set_property('target-duration', 20) # Set target duration to 20 seconds
# Set the location and playlist-location properties of hlssink
hlssink.set_property('location', f'segment{i:05d}.ts')
hlssink.set_property('playlist-location', f'playlist{i}.m3u8')
The main issue is that the conversion only creates one large segment per input file even if I specify 10 or 20 second segments in hlssink. Basically, it ignores the hlssink settings.