This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: Gstreamer pipeline

Part Number: AM5728

Tool/software: Linux

Hi

Can i save a video for every 10mins periodically (i.e, 6videos for an hr) using GST pipelines if so,

can you please help me how to do that.

It is possible to save one file.

Thanks,

Jahnavi

  • Hello,

    jahnavi mallpragada said:
    It is possible to save one file.

    Yes. The element to save in single file is filesink location=/path to file/name of the file.

    jahnavi mallpragada said:

    Can i save a video for every 10mins periodically (i.e, 6videos for an hr) using GST pipelines if so,

    can you please help me how to do that.

    Yes.

    Please what is the full use case? Is it capture->encode->save in file?

    BR
    Margarita

  • Hello,

    jahnavi mallpragada said:
    Can i save a video for every 10mins periodically (i.e, 6videos for an hr) using GST pipelines if so,

    You could try multifilesink element but set properties next-file and max-file-duration and location of course. You could check the multifilesink's properties by executing this command gst-inspect-1.0 multifilesink

    Let me know if this helps or if you have additional questions.

    BR
    Margarita

  • Hello Jahnavi,

    Please could you let me know is this solution is fine for you.
    But if this answers your question, please click the "This resolved my issue" button.
    Thank you!

    BR
    Margarita
  • Hi Margaita,

    Thanks for the reply, i have tried constructing a pipeline as follows using multifilesink, can you please check this and suggest me will this work ?

    This pipeline is to save a file for every 5mins along with timestamp

    gst-launch-1.0 v4l2src device=/dev/video0 ! timeoverlay halignment=right valignment=bottom ! clockoverlay halignment=left valignment=bottom time-format="%Y/%m/%d %H:%M:%S" ! tee name=t ! queue ! autovideosink t. ! queue ! videorate ! video/x-raw,framerate=1/300 ! ducatimpeg4enc bitrate=4000 ! multifilesink location="./video%06d.mp4" ! kmssink

    Thanks,
    Jahnavi
  • Hello,

    I am sorry but your pipeline will fail.


    Please, here is example that you could try on my side it is working:

    gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)30/1' ! vpe num-input-buffers=8 ! tee name=t ! queue ! ducatih264enc intra-interval=1 ! queue ! h264parse ! splitmuxsink location="save%d.mp4" muxer=mp4mux max-files=10 max-size-time=60000000000 t. ! queue ! kmssink -e

    gst-launch-1.0 playbin uri=file:///home/root/test/save1.mp4
    ...
    Execution ended after 0:01:00.006332604
    ...

    Here is the information about this pipeline and the settings that I have used:
    - v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)30/1' ! ...
    The camera on my side provides the resolution, framerate and format that  are set in the capsfilter.

    - vpe num-input-buffers=8 is used since the encoder requires on his input NV12 format but my camera provides YUY2.

    - tee element will split the pipeline to two branches.

    -first branch is the encoding branch. Please notice that after the encoder there is a parser element.

    -I have used splitmuxsink element. This element will slit the video every 1 min(60000000000 this value is in nanoseconds), will save max 10 files and will mux the video into mp4 container.
    You could check here for more information:
    gstreamer.freedesktop.org/.../gst-plugins-good-plugins-splitmuxsink.html

    -Second branch is the display branch.

    Hope this helps.

    BR
    Margarita

  • Thanks for the reply this has helped me.
  • Hello,

    I am glad that this issue is solved.
    Please next two weeks I will be OoO.
    If you have new gstreamer questions/issues open a new thread so I could help you before my vacation.
    Thank you!

    BR
    Margarita