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: AV live streaming

Part Number: AM5728


Tool/software: Linux

Hello Sir,

I am working on am5728 custom processor board.

on that board i want to capture video and audio both and store in file/transmit on rtsp.

gst-launch-1.0 -e v4l2src device="/dev/video2" ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! videoconvert ! queue ! ducatih264enc bitrate=500   intra-interval=1 ! h264parse ! rtph264pay mtu=200 !  udpsink host=<xxxxxxx > port=<xxxx>

I av used this pipeline to built live streaming from one node to another node..

kindly suggest modification to merge audio and video both for streaming...

Thanks in advance..

Best Regards ,

Hardik Sodha

  • Hello,

    First I would recommend you to test the both(audio and video) pipelines separately.
    After that you could try to merge them by using muxer element before to save in file or streaming.
    You could check the muxer elements by using gst-inspect-1.0 | grep "mux"
    Example with qtmux:
    gst-launch-1.0 \
    v4l2src \
    ! $VIDEO_CAPABILITIES \
    ! mux. \
    alsasrc \
    ! $AUDIO_CAPABILITIES \
    ! mux. \
    qtmux name=mux \
    ! filesink location=test.mov

    Hope this helps.

    BR
    Margarita
  • Hello,

    Please if this answers your question click the "This resolved my issue" button.
    If not, post the both pipelines (audio and video) , the merged pipeline, and debugging log.

    BR
    Margarita
  • thank you for your support

    actually now i am doing both pipeline individual first then will proceed for merging it.
    but now facing one issue in receiving pipeline ma'am

    i am posting the log below

    commands are listed below
    Tx:
    gst-launch-1.0 -e v4l2src device="/dev/video1" ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! videoconvert ! queue ! ducatih264enc bitrate=500 intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=5000

    /etc/init.d/weston stop

    Rx:
    gst-launch-1.0 -v udpsrc port=5000 ! 'application/x-rtp,media=(string)video, clock-rate=(int)90000, payload=(int)96' ! rtph264depay ! h264parse ! ducatih264dec ! vpe ! 'video/x-raw,format=(string)NV12, width=320,height=240' ! waylandsink sync=false &

    Setting pipeline to PAUSED ...
    [ 1316.114967] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
    Additional debug info:
    ../../../../gstreamer-1.8.3/libs/gst/base/gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming task paused, reason not-negotiated (-4)
    EOS on shutdown enabled -- waiting for EOS after Error
    Waiting for EOS...
    Stopping Weston
    root@am57xx-evm:~# Setting pipeline to PAUSED ...
    Caught SIGSEGV
    #0 __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
    #1 0xb6c42212 in __waitpid (pid=1177, stat_loc=0xbe88322c, options=0)
    #2 0xb6cc2b0c in g_on_error_stack_trace () from /usr/lib/libglib-2.0.so.0
    #3 0x000132e0 in ?? ()
    Spinning. Please run 'gdb gst-launch-1.0 1176' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.


    Regards,
    Hardik Sodha
  • Hello,

    When you are using waylandsink element you must not stop weston.
    You should stop weston when you are using kmssink element.

    Hope this helps.
    BR
    Margarita
  • Hello,
    Thank you
    I av tried with kmssink also..
    on screen it is only displaying please wait nothing else...

    but while using kmssink it didnt show any error like in previous case but i t was showing internal data flow error...

    log:
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
    Additional debug info:
    ../../../../gstreamer-1.8.3/libs/gst/base/gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming task paused, reason not-negotiated (-4)
    Execution ended after 0:00:00.034895579
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...
    Stopping Weston
    root@am57xx-evm:~# Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock

    the gst pipeline commands I used the previous1 but at the place of waylandsink i av used kmssink..

    Regards,
    Hardik Sodha
  • Hello,

    Please post the pipeline which is reporting v4l2src error.
    Most of the cases this error
    :v4l2src0:
    streaming task paused, reason not-negotiated (-4)
    means wrong caps filter.

    BR
    Margarita
  • Hello,

    Tx:
    gst-launch-1.0 v4l2src device="/dev/video1" ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! videoconvert ! queue ! ducatih264enc bitrate=500 intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=35000

    Rx:
    gst-launch-1.0 -v udpsrc port=35000 ! 'application/x-rtp,media=(string)video, clock-rate=(int)90000, payload=(int)96' ! rtph264depay ! h264parse ! ducatih264dec ! vpe ! 'video/x-raw,format=(string)NV12, width=320,height=240' ! kmssink sync=false &

    Regards,
    Hardik Sodha
  • Hello,

    You are executing this on same board?

    BR
    Margarita
  • Yes ma'am

    Regards,
    Hardik Sodha
  • Hello,

    When you are using this pipeline on board:
    gst-launch-1.0 v4l2src device="/dev/video1" ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! videoconvert ! queue ! ducatih264enc bitrate=500 intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=35000

    and receiving on PC it is working right?

    BR
    Margarita
  • Hello,
    No ma'am.
    ducati encoder is dedicated to board only isnt it? for PC it won't work.we use x264enc/dec
    i had been trying on evm board only for loopback case...

    Regards,
    Hardik

  • Hello,


    I ran some tests on my side with PSDK 4.03 + camera module.
    This is ifconfig command:
    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    ...

    Use case 1:

    Using waylandsink element so weston is running.

    gst-launch-1.0 -e v4l2src device=/dev/video1 ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! videoconvert ! queue ! ducatih264enc bitrate=500 intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=5000 &

    gst-launch-1.0 -v udpsrc port=5000 ! 'application/x-rtp,media=(string)video, clock-rate=(int)90000, payload=(int)96' ! rtph264depay ! h264parse ! ducatih264dec ! vpe ! 'video/x-raw,format=(string)NV12, width=320,height=240' ! waylandsink sync=false

    Everything is working fine no errors.
    Here is part of the log :

    Setting pipeline to PAUSED ...
    [ 785.711177] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    0' ! waylandsink sync=false video/x-raw,format=(string)NV12, width=320,height=24
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock

    Use case 2 with vpe instead of videoconvert:

    gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! vpe num-input-buffers=8 ! queue ! ducatih264enc bitrate=500 intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=5000 &

    gst-launch-1.0 -v udpsrc port=5000 ! 'application/x-rtp,media=(string)video, clock-rate=(int)90000, payload=(int)96' ! rtph264depay ! h264parse ! ducatih264dec ! vpe ! 'video/x-raw,format=(string)NV12, width=320,height=240' ! waylandsink sync=false

    This is also working.


    Gstreamer point of view streaming task paused, reason not-negotiated (-4) most of the cases means the video format (color space) you get from your video source (v4l2src) is not compatible with the sink.
    I would recommend you to try only capture without streaming to verify that is working.
    Please check the Multimedia wiki page for capture pipelines.
    processors.wiki.ti.com/.../Processor_Training:_Multimedia

    Hope this helps.

    BR
    Margarita

  • hello,

    gst-launch-1.0 -e v4l2src device=/dev/video1 ! 'video/x-raw,format=(string)YUY2,width=320,height=240,framerate=(fraction)25/1' ! videoconvert ! queue ! ducatih264enc bitrate=500 intra-interval=1 ! h264parse ! rtph264pay mtu=200 ! udpsink host=127.0.0.1 port=5000 &

    gst-launch-1.0 -v udpsrc port=5000 ! 'application/x-rtp,media=(string)video, clock-rate=(int)90000, payload=(int)96' ! rtph264depay ! h264parse ! ducatih264dec ! vpe ! 'video/x-raw,format=(string)NV12, width=320,height=240' ! waylandsink sync=false

    I av tried both the pipelines of videoconvert as well as vpe.

    but i am facing the same error shows internal data flow error...

    log:

    Setting pipeline to PAUSED ...
    [  268.632892] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
    Additional debug info:
    ../../../../gstreamer-1.8.3/libs/gst/base/gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming task paused, reason not-negotiated (-4)
    EOS on shutdown enabled -- waiting for EOS after Error
    Waiting for EOS...

    note :
    - i av tried one more pipeline also from the guide i.e capturing and directly displaying on lcd
    that too showing same kind of error...
    [ pipeline used : gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)YUY2, width=(int)1280, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink ]


    - one more thing i want to know that if we would like to use kmssink instead of wayland sink so we only need to specify connector no.
    and some notes i av referred link mentioned below ...

    www.ti.com/lit/an/sprac14/sprac14.pdf
    in this notes 8th point pg no.6 they have mention that kmssink accepts NV12 and omap_bo buffer point can you give some clarity about that point...


    Thanks & Regards,

    Hardik Sodha


  • Hello,

    This is a new issue not related with av muxing so please open a new topic regarding gstreamer capture problem.
    In it post the error that you are observing when you execute capture-display pipeline:
    gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)YUY2, width=(int)1280, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink
    You could add --gst-debug=3 and attach the log in the new thread.

    BR
    Margarita