udpsrc : I can't receive h264 packet and play it

Du Dengke pinganddu90 at gmail.com
Sat Aug 24 09:07:47 UTC 2019


I found add capsfilter: video/x-h264,stream-format=byte-stream
can solve that problem.

My video info: ffmpeg -i easy_c.mp4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'easy_c.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.41.100
  Duration: 00:05:00.64, start: 0.000000, bitrate: 2714 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 2712 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
    Metadata:
      handler_name    : VideoHandler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sender:
gst-launch-1.0 -v filesrc location=easy_c.mp4 ! qtdemux ! h264parse !
video/x-h264,stream-format=byte-stream ! queue ! rtph264pay ! udpsink
host=127.0.0.1

Receiver:
gst-launch-1.0 -v udpsrc address=127.0.0.1 caps="application/x-rtp" !
rtph264depay ! h264parse ! video/x-h264,stream-format=byte-stream ! queue !
avdec_h264 ! videoconvert ! ximagesink

Changes:
    turn the 'stream-format=avc' into 'stream-format=byte-stream'

Does you mp4 file's stream-format was byte-stream ?

//dengke

On Thu, Aug 22, 2019 at 9:25 AM Mathieu Duponchelle <mathieu at centricular.com>
wrote:

> The message says to add a queue, so maybe add a queue ;)
>
> On 8/22/19 3:21 AM, Du Dengke wrote:
>
> Thanks first!
> Unluckily, it not works for me, I am regret to update the gstreamer from
> source code, maybe it mixs the 1.8.3 and 1.16.0.
>
> Other words:
> when I decode the h264 and encode it in h264 in sender:
>     gst-launch-1.0 -v filesrc location=easy_c.mp4 ! qtdemux ! h264parse !
> avdec_h264 ! x264enc ! rtph264pay ! udpsink host=127.0.0.1
>
> Result:
>     the receiver can show the video, but with much delay and drop a lot of
> frame:
>
> ``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
> WARNING: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
> Pipeline construction is invalid, please add queues.
> Additional debug info:
> ../libs/gst/base/gstbasesink.c(1218): gst_base_sink_query_latency ():
> /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
> Not enough buffering available for  the processing deadline of
> 0:00:00.015000000, add enough queues to buffer  0:00:00.015000000
> additional data. Shortening processing latency to 0:00:00.000000000.
> WARNING: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
> A lot of buffers are being dropped.
> Additional debug info:
> ../libs/gst/base/gstbasesink.c(3005): gst_base_sink_is_too_late ():
> /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
> There may be a timestamping problem, or this computer is too slow.
> WARNING: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
> A lot of buffers are being dropped.
> Additional debug info:
> ../libs/gst/base/gstbasesink.c(3005): gst_base_sink_is_too_late ():
> /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
> There may be a timestamping problem, or this computer is too slow.
>
> ``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
>
> //dengke
>
> On Wed, Aug 21, 2019 at 9:40 PM Mathieu Duponchelle <
> mathieu at centricular.com> wrote:
>
>> Hey,
>>
>> Try specifying a host on the udpsink and an address on the udpsrc, these
>> pipelines work for me:
>>
>> Receiver:
>>
>> gst-launch-1.0 udpsrc caps="application/x-rtp" address=127.0.0.1 !
>> rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! queue ! xvimagesink
>>
>> Sender:
>>
>> gst-launch-1.0 filesrc location=/home/meh/Videos/small_ball.mp4 ! qtdemux
>> ! h264parse ! rtph264pay ! udpsink host=127.0.0.1
>>
>> On 8/21/19 10:49 AM, Du Dengke wrote:
>>
>> Hi experts:
>> OS: Ubuntu 16.04.6 LTS
>> Gstreamer Version: I update it to 1.16.0
>>
>> Sender and Receiver both on one machine.
>>
>> Sender:
>>     GST_DEBUG=4 gst-launch-1.0 filesrc location=easy_c.mp4 ! qtdemux !
>> h264parse ! rtph264pay ! udpsink
>> I using wireshark to watch, all thing go well, something like:
>>     ......
>>     31072 121.161706931 127.0.0.1 127.0.0.1 UDP 1442 51378 → 5004 Len=1400
>>     ......
>>
>> Receiver:
>>     GST_DEBUG=4 gst-launch-1.0 udpsrc caps="application/x-rtp" !
>> rtph264depay ! h264parse ! avdec_h264 ! xvimagesink
>>
>> seems go well, but nothing appear, I take some log here:
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Setting pipeline to PLAYING ...
>> 0:00:00.020110200  4381      0x202cc00 INFO               GST_EVENT
>> gstevent.c:1450:gst_event_new_latency: creating latency event
>> 0:00:00.000000000
>> 0:00:00.020125274  4381      0x202cc00 INFO                     bin
>> gstbin.c:2780:gst_bin_do_latency_func:<pipeline0> configured latency of
>> 0:00:00.000000000
>> 0:00:00.020136579  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2503:gst_bin_element_set_state:<xvimagesink0> current READY
>> pending PAUSED, desired next PLAYING
>> 0:00:00.020142248  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2957:gst_bin_change_state_func:<pipeline0> child 'xvimagesink0' is
>> changing state asynchronously to PLAYING
>> 0:00:00.020148377  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2503:gst_bin_element_set_state:<avdec_h264-0> current PAUSED
>> pending VOID_PENDING, desired next PLAYING
>> 0:00:00.020154187  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2676:gst_element_continue_state:<avdec_h264-0> completed state
>> change to PLAYING
>> 0:00:00.020159424  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2579:_priv_gst_element_state_changed:<avdec_h264-0> notifying
>> about state-changed PAUSED to PLAYING (VOID_PENDING pending)
>> 0:00:00.020166928  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2951:gst_bin_change_state_func:<pipeline0> child 'avdec_h264-0'
>> changed state to 4(PLAYING) successfully
>> 0:00:00.020173149  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2503:gst_bin_element_set_state:<h264parse0> current PAUSED pending
>> VOID_PENDING, desired next PLAYING
>> 0:00:00.020178564  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2676:gst_element_continue_state:<h264parse0> completed state
>> change to PLAYING
>> 0:00:00.020183568  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2579:_priv_gst_element_state_changed:<h264parse0> notifying
>> about state-changed PAUSED to PLAYING (VOID_PENDING pending)
>> 0:00:00.020190138  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2951:gst_bin_change_state_func:<pipeline0> child 'h264parse0'
>> changed state to 4(PLAYING) successfully
>> 0:00:00.020196292  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2503:gst_bin_element_set_state:<rtph264depay0> current PAUSED
>> pending VOID_PENDING, desired next PLAYING
>> 0:00:00.020201631  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2676:gst_element_continue_state:<rtph264depay0> completed
>> state change to PLAYING
>> 0:00:00.020206440  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2579:_priv_gst_element_state_changed:<rtph264depay0> notifying
>> about state-changed PAUSED to PLAYING (VOID_PENDING pending)
>> 0:00:00.020212854  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2951:gst_bin_change_state_func:<pipeline0> child 'rtph264depay0'
>> changed state to 4(PLAYING) successfully
>> 0:00:00.020222030  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2676:gst_element_continue_state:<udpsrc0> completed state
>> change to PLAYING
>> 0:00:00.020228362  4381      0x202cc00 INFO              GST_STATES
>> gstelement.c:2579:_priv_gst_element_state_changed:<udpsrc0> notifying about
>> state-changed PAUSED to PLAYING (VOID_PENDING pending)
>> 0:00:00.020234673  4381      0x202cc00 INFO              GST_STATES
>> gstbin.c:2951:gst_bin_change_state_func:<pipeline0> child 'udpsrc0' changed
>> state to 4(PLAYING) successfully
>> New clock: GstSystemClock
>> 0:01:17.678501741  4381      0x21460a0 INFO               GST_EVENT
>> gstevent.c:901:gst_event_new_segment: creating segment event time segment
>> start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999,
>> rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000,
>> base=0:00:00.000000000, position 0:00:00.000000000, duration
>> 99:99:99.999999999
>> 0:01:17.678521905  4381      0x21460a0 INFO                 basesrc
>> gstbasesrc.c:2962:gst_base_src_loop:<udpsrc0> marking pending DISCONT
>> 0:01:17.678543028  4381      0x21460a0 INFO               GST_EVENT
>> gstevent.c:901:gst_event_new_segment: creating segment event time segment
>> start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999,
>> rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000,
>> base=0:00:00.000000000, position 0:01:17.658403007, duration
>> 99:99:99.999999999
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> The receiver stop here.
>>
>> My question:
>>     How to let me know the receiver receive the packets, and why can't i
>> play it?
>>
>> //dengke
>>
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190824/9808e83e/attachment-0001.html>


More information about the gstreamer-devel mailing list