gstreamer : record a stream while playing

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

gstreamer : record a stream while playing

Duchassin Frederic

Hello all,


If i want to record a stream while playing, i think that I can use this pipeline :

gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue ! filesink location=/home/firsttry.ts


this pipeline should do this :


                                             /  [ decodebin | queue | kmssink ]           (playing_branch)
filesrc | queue | typefind | tee
                                             \  [ queue | filesink ]                                 (recording_branch)


but it doesn't work the pipeline never start :

gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue ! filesink location=/home/firsttry.ts
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
        Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017 02:37:53
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1


whereas if I delete the recording branch, it works correctly.

root@cl-som-imx8:~# gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue ! filesink location=/home/firsttry.ts
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
        Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017 02:37:53
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
^Chandling interrupt.
Interrupt: Stopping pipeline ...
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
root@cl-som-imx8:~# gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. ! decodebin ! queue ! kmssink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
        Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017 02:37:53
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
------------------------
    Track 00 [video_0] Enabled
        Duration: 0:01:58.601811000
        Language: und
    Mime:
        video/x-h265, parsed=(boolean)true, alignment=(string)au, stream-format=(string)byte-stream, width=(int)3840, height=(int)2160, framerate=(fraction)30/1
------------------------
------------------------
    Track 01 [audio_0] Enabled
        Duration: 0:01:58.528000000
        Language: und
    Mime:
        audio/mpeg, mpegversion=(int)4, channels=(int)2, rate=(int)48000, bitrate=(int)192000
------------------------
====== VPUDEC: 4.3.5 build on Jan 21 2019 17:47:26. ======
        wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jan 21 2019 17:02:05)
        vpulib: 1.1.1
        firmware: 1.1.1.65535

====== BEEP: 4.3.5 build on Jan 21 2019 17:47:16. ======
        Core: AAC decoder Wrapper  build on Dec  7 2017 18:13:51
 file: /us[ 1437.616914] alloc_contig_range: 42 callbacks suppressed
r/lib/imx-mm/audio-codec/wrap/lib[ 1437.616918] alloc_contig_range: [5eb00, 5f9d5) PFNs busy
_aacd_wrap_arm_elinux.so.3
 1437.631555] alloc_contig_range: [5ec00, 5fad5) PFNs busy
3mCODEC: BLN_MAD-MMCODECS_AACD_AR[ 1437.639743] alloc_contig_range: [5ec00, 5fbd5) PFNs busy
M_03.09.00_ARMV8  build on Sep 20[ 1437.648085] alloc_contig_range: [5ec00, 5fcd5) PFNs busy
 2017 15:02:50.
[ 1437.656130] alloc_contig_range: [5ec00, 5fdd5) PFNs busy
[ 1437.662854] alloc_contig_range: [5f000, 5fed5) PFNs busy
[ 1437.668731] alloc_contig_range: [5f000, 5ffd5) PFNs busy
[ 1437.674615] alloc_contig_range: [5f000, 600d5) PFNs busy
[ 1437.681140] alloc_contig_range: [5f000, 601d5) PFNs busy
[ 1437.687145] alloc_contig_range: [5f000, 602d5) PFNs busy
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock


If someone has an idea about the problem...


Thanks


Frederic


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

MaZderMind
Hi

you probably need a `queue`-Element in each branch after the tee element.

-Peter


Am 05.02.19 um 16:40 schrieb Duchassin Frederic:

> Hello all,
>
>
> If i want to record a stream while playing, i think that I can use this
> pipeline :
>
> gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue !
> typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue !
> filesink location=/home/firsttry.ts
>
>
> this pipeline should do this :
>
>
>                                              /  [ decodebin | queue |
> kmssink ]           (playing_branch)
> filesrc | queue | typefind | tee
>                                              \  [ queue | filesink ]    
>                             (recording_branch)
>
>
> but it doesn't work the pipeline never start :
>
> gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue !
> typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue !
> filesink location=/home/firsttry.ts
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
>
> ====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
>         Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017
> 02:37:53
>  file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
>
> whereas if I delete the recording branch, it works correctly.
>
> root@cl-som-imx8:~# gst-launch-1.0 filesrc
> location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. !
> decodebin ! queue ! kmssink t. ! queue ! filesink location=/home/firsttry.ts
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
>
> ====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
>         Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017
> 02:37:53
>  file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
> ^Chandling interrupt.
> Interrupt: Stopping pipeline ...
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to NULL ...
> Freeing pipeline ...
> root@cl-som-imx8:~# gst-launch-1.0 filesrc
> location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. !
> decodebin ! queue ! kmssink
> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
>
> ====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
>         Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017
> 02:37:53
>  file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
> ------------------------
>     Track 00 [video_0] Enabled
>         Duration: 0:01:58.601811000
>         Language: und
>     Mime:
>         video/x-h265, parsed=(boolean)true, alignment=(string)au,
> stream-format=(string)byte-stream, width=(int)3840, height=(int)2160,
> framerate=(fraction)30/1
> ------------------------
> ------------------------
>     Track 01 [audio_0] Enabled
>         Duration: 0:01:58.528000000
>         Language: und
>     Mime:
>         audio/mpeg, mpegversion=(int)4, channels=(int)2,
> rate=(int)48000, bitrate=(int)192000
> ------------------------
> ====== VPUDEC: 4.3.5 build on Jan 21 2019 17:47:26. ======
>         wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jan 21 2019
> 17:02:05)
>         vpulib: 1.1.1
>         firmware: 1.1.1.65535
>
> ====== BEEP: 4.3.5 build on Jan 21 2019 17:47:16. ======
>         Core: AAC decoder Wrapper  build on Dec  7 2017 18:13:51
>  file: /us[ 1437.616914] alloc_contig_range: 42 callbacks suppressed
> r/lib/imx-mm/audio-codec/wrap/lib[ 1437.616918] alloc_contig_range:
> [5eb00, 5f9d5) PFNs busy
> _aacd_wrap_arm_elinux.so.3
>  1437.631555] alloc_contig_range: [5ec00, 5fad5) PFNs busy
> 3mCODEC: BLN_MAD-MMCODECS_AACD_AR[ 1437.639743] alloc_contig_range:
> [5ec00, 5fbd5) PFNs busy
> M_03.09.00_ARMV8  build on Sep 20[ 1437.648085] alloc_contig_range:
> [5ec00, 5fcd5) PFNs busy
>  2017 15:02:50.
> [ 1437.656130] alloc_contig_range: [5ec00, 5fdd5) PFNs busy
> [ 1437.662854] alloc_contig_range: [5f000, 5fed5) PFNs busy
> [ 1437.668731] alloc_contig_range: [5f000, 5ffd5) PFNs busy
> [ 1437.674615] alloc_contig_range: [5f000, 600d5) PFNs busy
> [ 1437.681140] alloc_contig_range: [5f000, 601d5) PFNs busy
> [ 1437.687145] alloc_contig_range: [5f000, 602d5) PFNs busy
> Pipeline is PREROLLED ...
> Setting pipeline to PLAYING ...
> New clock: GstSystemClock
>
> If someone has an idea about the problem...
>
>
> Thanks
>
>
> Frederic
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

Duchassin Frederic

Hi,


Even with a queue in each branch it doesn't work :

gst-launch-1.0 filesrc location=/home/sefram/TS/4kfile.ts ! queue ! typefind ! tee name=t t. ! queue ! decodebin ! queue ! kmssink t. ! queue ! filesink location=/home/sefram/TS/essai.ts

Frederic


Le 05/02/2019 à 16:47, MaZderMind a écrit :
Hi

you probably need a `queue`-Element in each branch after the tee element.

-Peter


Am 05.02.19 um 16:40 schrieb Duchassin Frederic:
Hello all,


If i want to record a stream while playing, i think that I can use this
pipeline :

gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue !
typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue !
filesink location=/home/firsttry.ts


this pipeline should do this :


                                             /  [ decodebin | queue |
kmssink ]           (playing_branch)
filesrc | queue | typefind | tee
                                             \  [ queue | filesink ]    
                            (recording_branch)


but it doesn't work the pipeline never start :

gst-launch-1.0 filesrc location=/home/sefram/TS/Samsung.ts ! queue !
typefind ! tee name=t t. ! decodebin ! queue ! kmssink t. ! queue !
filesink location=/home/firsttry.ts
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
        Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017
02:37:53
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1

whereas if I delete the recording branch, it works correctly.

root@cl-som-imx8:~# gst-launch-1.0 filesrc
location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. !
decodebin ! queue ! kmssink t. ! queue ! filesink location=/home/firsttry.ts
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
        Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017
02:37:53
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
^Chandling interrupt.
Interrupt: Stopping pipeline ...
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
root@cl-som-imx8:~# gst-launch-1.0 filesrc
location=/home/sefram/TS/Samsung.ts ! queue ! typefind ! tee name=t t. !
decodebin ! queue ! kmssink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.3.5 build on Jan 21 2019 17:47:10. ======
        Core: BLN_MAD-MMLAYER_MPG2PARSER_04.05.16  build on Sep 14 2017
02:37:53
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm_elinux.so.3.1
------------------------
    Track 00 [video_0] Enabled
        Duration: 0:01:58.601811000
        Language: und
    Mime:
        video/x-h265, parsed=(boolean)true, alignment=(string)au,
stream-format=(string)byte-stream, width=(int)3840, height=(int)2160,
framerate=(fraction)30/1
------------------------
------------------------
    Track 01 [audio_0] Enabled
        Duration: 0:01:58.528000000
        Language: und
    Mime:
        audio/mpeg, mpegversion=(int)4, channels=(int)2,
rate=(int)48000, bitrate=(int)192000
------------------------
====== VPUDEC: 4.3.5 build on Jan 21 2019 17:47:26. ======
        wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jan 21 2019
17:02:05)
        vpulib: 1.1.1
        firmware: 1.1.1.65535

====== BEEP: 4.3.5 build on Jan 21 2019 17:47:16. ======
        Core: AAC decoder Wrapper  build on Dec  7 2017 18:13:51
 file: /us[ 1437.616914] alloc_contig_range: 42 callbacks suppressed
r/lib/imx-mm/audio-codec/wrap/lib[ 1437.616918] alloc_contig_range:
[5eb00, 5f9d5) PFNs busy
_aacd_wrap_arm_elinux.so.3
 1437.631555] alloc_contig_range: [5ec00, 5fad5) PFNs busy
3mCODEC: BLN_MAD-MMCODECS_AACD_AR[ 1437.639743] alloc_contig_range:
[5ec00, 5fbd5) PFNs busy
M_03.09.00_ARMV8  build on Sep 20[ 1437.648085] alloc_contig_range:
[5ec00, 5fcd5) PFNs busy
 2017 15:02:50.
[ 1437.656130] alloc_contig_range: [5ec00, 5fdd5) PFNs busy
[ 1437.662854] alloc_contig_range: [5f000, 5fed5) PFNs busy
[ 1437.668731] alloc_contig_range: [5f000, 5ffd5) PFNs busy
[ 1437.674615] alloc_contig_range: [5f000, 600d5) PFNs busy
[ 1437.681140] alloc_contig_range: [5f000, 601d5) PFNs busy
[ 1437.687145] alloc_contig_range: [5f000, 602d5) PFNs busy
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

If someone has an idea about the problem...


Thanks


Frederic


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

Tim Müller
On Tue, 2019-02-05 at 17:23 +0100, Duchassin Frederic wrote:

Hi Frederic,

> Even with a queue in each branch it doesn't work :
> gst-launch-1.0 filesrc location=/home/sefram/TS/4kfile.ts ! queue !
> typefind ! tee name=t t. ! queue ! decodebin ! queue ! kmssink t. !
> queue ! filesink location=/home/sefram/TS/essai.ts

Chances are that you are hitting one of the queue limits too early,
since you have a very high bitrate stream and the queue limits are
fairly small by default (~ 200 buffers, 10MB IIRC). That would prevent
the pipeline from prerolling.

Try unsetting the limit on the queue that feeds into filesink with
queue max-size-bytes=0 max-size-time=0 max-size-buffers=0

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

Duchassin Frederic
Hi Tim,

You're completely right! Many many thanks for your help.

Great !!!

BR


Frederic


Le 05/02/2019 à 17:49, Tim Müller a écrit :

> On Tue, 2019-02-05 at 17:23 +0100, Duchassin Frederic wrote:
>
> Hi Frederic,
>
>> Even with a queue in each branch it doesn't work :
>> gst-launch-1.0 filesrc location=/home/sefram/TS/4kfile.ts ! queue !
>> typefind ! tee name=t t. ! queue ! decodebin ! queue ! kmssink t. !
>> queue ! filesink location=/home/sefram/TS/essai.ts
> Chances are that you are hitting one of the queue limits too early,
> since you have a very high bitrate stream and the queue limits are
> fairly small by default (~ 200 buffers, 10MB IIRC). That would prevent
> the pipeline from prerolling.
>
> Try unsetting the limit on the queue that feeds into filesink with
> queue max-size-bytes=0 max-size-time=0 max-size-buffers=0
>
> Cheers
>   Tim
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

Duchassin Frederic
Hello All,


Just a new question in relation with this pipeline :

Is it possible to add all the gstreamer sinks to my pipeline AND only
link one branch.

That's to say, just link the record branch. The decode branch is in
pipeline but not linked. At this point, my first test show that it
doesn't work.


BR


Frédéric

Le 05/02/2019 à 19:12, Duchassin Frederic a écrit :

> Hi Tim,
>
> You're completely right! Many many thanks for your help.
>
> Great !!!
>
> BR
>
>
> Frederic
>
>
> Le 05/02/2019 à 17:49, Tim Müller a écrit :
>> On Tue, 2019-02-05 at 17:23 +0100, Duchassin Frederic wrote:
>>
>> Hi Frederic,
>>
>>> Even with a queue in each branch it doesn't work :
>>> gst-launch-1.0 filesrc location=/home/sefram/TS/4kfile.ts ! queue !
>>> typefind ! tee name=t t. ! queue ! decodebin ! queue ! kmssink t. !
>>> queue ! filesink location=/home/sefram/TS/essai.ts
>> Chances are that you are hitting one of the queue limits too early,
>> since you have a very high bitrate stream and the queue limits are
>> fairly small by default (~ 200 buffers, 10MB IIRC). That would prevent
>> the pipeline from prerolling.
>>
>> Try unsetting the limit on the queue that feeds into filesink with
>> queue max-size-bytes=0 max-size-time=0 max-size-buffers=0
>>
>> Cheers
>>   Tim
>>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

Tim Müller
On Wed, 2019-02-06 at 09:32 +0100, Duchassin Frederic wrote:

Hi Frederic,

> Is it possible to add all the gstreamer sinks to my pipeline AND
> only link one branch.
>
> That's to say, just link the record branch. The decode branch is in
> pipeline but not linked. At this point, my first test show that it
> doesn't work.

Yes, that is possible, but I wouldn't really recommend it.

If you put in sinks that don't receive data at the beginning, the
pipeline will not preroll (start up).

You can work around that by setting these sinks to async=false.

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer : record a stream while playing

Duchassin Frederic
Hi Tim,


I have solve my problem by adding/removing elements from my pipeline.

It's not very very beautiful because all elements are created in my main
program and it lead to referencing them before removing from the
pipeline (because i would like to keep these elements).

BR


Frederic


Le 06/02/2019 à 10:07, Tim Müller a écrit :

> On Wed, 2019-02-06 at 09:32 +0100, Duchassin Frederic wrote:
>
> Hi Frederic,
>
>> Is it possible to add all the gstreamer sinks to my pipeline AND
>> only link one branch.
>>
>> That's to say, just link the record branch. The decode branch is in
>> pipeline but not linked. At this point, my first test show that it
>> doesn't work.
> Yes, that is possible, but I wouldn't really recommend it.
>
> If you put in sinks that don't receive data at the beginning, the
> pipeline will not preroll (start up).
>
> You can work around that by setting these sinks to async=false.
>
> Cheers
>   Tim
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel