Audio only playback with playbin
Jan Schmidt
jan at widgetgrove.com.au
Fri Jan 6 12:24:22 UTC 2023
Hi,
On 3/1/23 20:36, hjuvi via gstreamer-devel wrote:
> Hello,
>
> I'm writing a terminal-based audio player application based on GStreamer (currently testing with
> version 1.20.4).
>
> This is really intended to be an audio player only, but I'd like to be able to play the audio part
> of an audio/video file.
> For this purpose, I'm using a fake sink for the video, to avoid having a popup window with the
> video.
If you set the flags property on playbin to 'soft-volume+audio' it won't
try and display the video part at all. You can use the
gst_util_set_object_arg() method to set the flags using the string.
Cheers,
Jan.
>
> My player works perfectly for pure audio files, but I have some problems with audio/video files. It
> plays correctly if I just let it play, but:
> - It seems that I don't receive the EOS message (only 'about-to-finish').
> - If I try to seek, it works for a moment, but then it ends up getting lost, with strange
> behaviours (position not updated, audio freeze or acceleration), and most of the time it freezes
> completely (the main loop is blocked).
>
> I'm seeking with (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT) flags.
>
> My questions are:
> 1) Is the playbin appropriate for this purpose? I find it very convenient, so I hope it is not
> necessary to build the pipeline for audio only.
> 2) Is the fake sink (fakesink or fakevideosink) the right solution to disable video? (I used
> fakevideosink because the behaviour was even worse with fakesink).
> 3) Does the fake sink just disable the output, or does it saves the video decoding (which would be
> useless)?
> 4) Am I using the right flags to seek? (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT)
> 5) If there is no obvious error in what I've done, would you suggest any method to debug this?
> (additional traces...)
>
> In case it might help to understand, the source code is here:
> https://forge.tedomum.net/hjuvi/ondine
> And all the calls to GStreamer are done in this particular file:
> https://forge.tedomum.net/hjuvi/ondine/-/blob/main/src/ondine_player.c
>
> Thanks a lot for your help.
>
> --
> Cédric
More information about the gstreamer-devel
mailing list