Audio only playback with playbin
Jan Schmidt
thaytan at noraisin.net
Wed Jan 11 14:59:58 UTC 2023
Hi,
On 12/1/23 01:55, hjuvi wrote:
> Hi,
>
> Thanks a lot for this option.
>
> It took me some time to find the related documentation:
> https://gstreamer.freedesktop.org/documentation/playback/playsink.html?gi-language=c#GstPlayFlags
>
> It does improve the behaviour with a problematic video, it doesn't seem to freeze anymore.
> I don't know exactly what's happening "under the hood", compared with fakevideosink. Maybe the video is discarded at an earlier stage in the pipeline, I don't know...
> In the end, it seems to be a better option, and I guess that I'll switch to this solution, after having done some more tests with other videos.
>
> Thanks a lot for the support!
> I'm still interested in the "under the hood" difference details (if this can be explained in simple terms)
When the video flag is switched off, playbin will ignore any video
streams in the file. The video won't even be decoded, compared to
fakevideosink that will still do decoding and then discard the frames.
If you want to see what the pipeline looks like inside, you can dump a
dot graph following
https://embeddedartistry.com/blog/2018/02/22/generating-gstreamer-pipeline-graphs/
Cheers,
Jan.
>
> Cédric
>
>
> 6 janvier 2023 13:24 "Jan Schmidt via gstreamer-devel" <gstreamer-devel at lists.freedesktop.org> a
> écrit:
>
>> 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