Tee with three forks and two appsinks: last appsink doesn't callback

Anton Pryima zingfrid at gmail.com
Tue Sep 14 16:08:11 UTC 2021


Dwight,

I still do not understand, why do you need to encode raw frames to h264 in
the first pipeline (vpuenc_h264), and decode its back to the raw frames in
the second pipeline (avdec_h264). It will consume a lot of CPU power and in
your case (if you're running this on the same PC) it is useless, as you
already have raw (decoded) frames right after v4l2src.
So, as my first suggestion, it is more reasonable to appsink raw frames
right after src, and then, using appsrc, encode these frames to h264 and
put them into splitmuxsink, and at another pipeline encode it to the
jpegenc and do whatever you want.

Best regards,
Anton.

On Tue, Sep 14, 2021 at 6:43 PM Dwight Kulkarni <dwight at realtime-7.com>
wrote:

> Hi Anton,
>
> 1) Is there a way I can copy frames out of splitmuxsink ?   Which callback
> would I use for that if it's possible ?  Right now I am only using callback
> of "format-location" on splitmuxsink.
>
> 2) Suppose I split up the pipeline as follows:
>
> (this is already working)
> *pipeline#1* = "v4l2src device=/dev/video1 ! video/x-raw, width=1920,
> height=1080, framerate=15/1 ! vpuenc_h264 ! tee name=v ! queue ! h264parse
> ! appsink name=h264vid max-buffers=1 drop=true v. ! queue ! h264parse !
> splitmuxsink name=filesink location=./videos/video%02d.mkv
> max-size-time=10000000000 muxer-properties=\"properties,streamable=true\" ";
>
>
> *pipeline#2* = "appsrc name=jpegvideosrc  ! queue ! avdec_h264 ! jpegenc
> ! appsink name=jpegsink max-buffers=1 drop=true"
>
> For "pipeline#2" do I still need to terminate in an appsink or can I tap
> into the end result of jpegenc with a callback (eg. new-sample or
> need-data) and giving it a name. Something like:
>
> string other_pipeline = "appsrc name=jpegvideosrc  ! queue ! avdec_h264 !
> jpegenc name=jpegsink"
>
>
>
> On Tue, Sep 14, 2021 at 10:57 AM Anton Pryima via gstreamer-devel <
> gstreamer-devel at lists.freedesktop.org> wrote:
>
>> Hello Dwight.
>>
>> Why do you need to construct a so complicated pipeline and do both
>> encoding and decoding?
>> Why not make a couple of pipelines:
>> 1. v4l2src device=/dev/video1 ! video/x-raw, width=1920, height=1080,
>> framerate=15/1 ! appsink
>> 2. appsrc -> vpuenc_h264 ! splitmuxsink
>> 3. appsrc -> jpegenc ! whatever you need next....  or just copy frames
>> where every you need instead of second appsink.
>>
>> Beste regards,
>> Anton.
>>
>> On Tue, Sep 14, 2021 at 5:43 PM Dwight Kulkarni via gstreamer-devel <
>> gstreamer-devel at lists.freedesktop.org> wrote:
>>
>>> Hi all,
>>>
>>> I am trying to setup a pipeline with tee that has three forks. One of
>>> the forks is a jpegsink that I want to then access the image. Whereas the
>>> first two forks are working the last one for jpegsink is not.
>>>
>>> Here is what I do:
>>>
>>> gst_init (0, NULL);
>>> string pipeline = "v4l2src device=/dev/video1 ! video/x-raw, width=1920,
>>> height=1080, framerate=15/1 ! vpuenc_h264 ! tee name=v ! queue ! h264parse
>>> ! appsink name=h264vid max-buffers=1 drop=true v. ! queue ! h264parse !
>>> splitmuxsink name=filesink location=./videos/video%02d.mkv
>>> max-size-time=10000000000 muxer-properties=\"properties,streamable=true\"
>>> v. ! queue ! avdec_h264 ! jpegenc ! appsink name=jpegsink max-buffers=1
>>> drop=true";
>>> gstreamer_main_video_pipeline = gst_parse_launch(pipeline.c_str(),NULL);
>>>
>>> GstElement * jpegsink =
>>> gst_bin_get_by_name_recurse_up(GST_BIN(gstreamer_main_video_pipeline),
>>> "jpegsink");
>>>
>>> JpegContext* ctx = g_new0 (JpegContext, 1);
>>> g_signal_connect (G_OBJECT(jpegsink), "new-sample",
>>> G_CALLBACK(new_sample), ctx);
>>>
>>>
>>> I never get the callback to new_sample, but the pipeline is running and
>>> other two tee forks work properly.
>>>
>>> Any help would be appreciated!
>>>
>>> --
>>> Sincerely,
>>>
>>> Dwight Kulkarni
>>>
>>
>
> --
> Sincerely,
>
> Dwight Kulkarni
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210914/a7078911/attachment-0001.htm>


More information about the gstreamer-devel mailing list