Armadilloフォーラム

Armadillo-810でのH.264映像のネットワーク配信について

ds_akahane

2015年4月6日 9時38分

いつもお世話になります。

Armadillo-810 にてH.264エンコードを行いそのデータをGstreamerにて
ネットワーク配信したいと考えております。

そこで、以下のGstreamerを実行してみましたがエラー終了してしまいます。
gst-launch-1.0 -v videotestsrc ! video/x-raw,format=NV12,width=320,height=240,framerate=30/1 ! acmh264enc ! rtph264pay ! tcpserversink host=127.0.0.1 port=5555

--- 出力内容 ---
Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0: current-port = 5555
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)320, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)320, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstAcmH264Enc:acmh264enc0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)320, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)320, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstAcmH264Enc:acmh264enc0.GstPad:src: caps = video/x-h264, codec_data=(buffer)014d401fffe10013674d401fe98283f4200000030020000007908001000468ee0b88, stream-format=(string)byte-stream, framerate=(fraction)30/1, level=(string)3.1, profile=(string)main, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1
Redistribute latency...
/GstPipeline:pipeline0/GstAcmH264Enc:acmh264enc0.GstPad:src: caps = video/x-h264, codec_data=(buffer)014d401fffe10013674d401fe98283f4200000030020000007908001000468ee0b88, stream-format=(string)byte-stream, framerate=(fraction)30/1, level=(string)3.1, profile=(string)main, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1
ERROR: from element /GstPipeline:pipeline0/GstAcmH264Enc:acmh264enc0: Could not encode stream.
Additional debug info:
gstacmh264enc.c(2545): gst_acm_h264_enc_handle_out_frame (): /GstPipeline:pipeline0/GstAcmH264Enc:acmh264enc0:
failed gst_video_encoder_finish_frame()
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
/GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0: current-port = 0
Freeing pipeline ...
--------------------

エレメントの繋ぎなどご助言頂ければ幸いです。

以上、よろしくお願い致します。

コメント

at_takahiro.nakamura

2015年4月9日 16時00分

takahiro.nakamuraです。

> エレメントの繋ぎなどご助言頂ければ幸いです。

rtph264payの config-intervalプロパティを設定してみてはどうでしょうか?

gst-launch-1.0 -v videotestsrc !video/x-raw,format=NV12,width=320,height=240,framerate=30/1 ! acmh264enc !rtph264pay config-interval=3 ! tcpserversink host=127.0.0.1 port=5555 

もし、上記でもエラーが発生する場合、
tcpserversink を udpsink に変更する事は可能ですか?
以下のパイプラインはこちらで確認済です。

gst-launch-1.0 -v videotestsrc \
    ! video/x-raw,format=NV12,width=320,height=240,framerate=30/1 \
    ! acmh264enc \
    ! video/x-h264, stream-format=avc \
    ! rtph264pay config-interval=3 \
    ! udpsink force-ipv4=true host=127.0.0.1 port=5555

ds_akahane

2015年4月10日 8時58分

有難うございます。

RTPでのArmadillo-a800 カメラのストリーム通信が行えることが確認できました。

ただ、2秒ほどのラグがあるのですがこれを解消する方法などありますでしょうか?

以上、よろしくお願いします。

> takahiro.nakamuraです。
>
> > エレメントの繋ぎなどご助言頂ければ幸いです。
>
> rtph264payの config-intervalプロパティを設定してみてはどうでしょうか?
>

> gst-launch-1.0 -v videotestsrc !video/x-raw,format=NV12,width=320,height=240,framerate=30/1 ! acmh264enc !rtph264pay config-interval=3 ! tcpserversink host=127.0.0.1 port=5555 
> 

>
> もし、上記でもエラーが発生する場合、
> tcpserversink を udpsink に変更する事は可能ですか?
> 以下のパイプラインはこちらで確認済です。
>

> gst-launch-1.0 -v videotestsrc \
>     ! video/x-raw,format=NV12,width=320,height=240,framerate=30/1 \
>     ! acmh264enc \
>     ! video/x-h264, stream-format=avc \
>     ! rtph264pay config-interval=3 \
>     ! udpsink force-ipv4=true host=127.0.0.1 port=5555
> 

at_takahiro.nakamura

2015年4月13日 13時31分

takahiro.nakamuraです。

> ただ、2秒ほどのラグがあるのですがこれを解消する方法などありますでしょうか?

ラグについてですが、Armadillo-810 (エンコード)よりは、再生(デコード)側に依存していると思われます。

圧縮率が低下しますが、acmh264encのProperties(max-gop-length,b-pic-mode等)を設定する事で、
デコーダの遅延を多少抑える事が出来ると思います。

gst-launch-1.0 -v \
        v4l2src device=/dev/video1 \
        ! video/x-raw,width=640,height=480,framerate=30/1 \
        ! acmh264enc max-gop-length=1 b-pic-mode=0 bitrate=2000000 \
        ! video/x-h264, stream-format=avc \
        ! rtph264pay config-interval=3 \
        ! udpsink force-ipv4=true port=5555 host=127.0.0.1

弊社のArmadillo-840でデコードして確認した所、上記設定でのラグは0.5秒程度でした。

なお、Armadillo-840(デコーダ)のパイプラインは以下です。

VIDEO_CAPS=" application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
VIDEO_DEPAY="rtph264depay ! h264parse"
VIDEO_DEC="  acmh264dec buf-pic-cnt=3 stride=1920 ! video/x-raw,width=1920,height=1080"
VIDEO_SINK=" acmfbdevsink device=/dev/fb0 max-lateness=2000000000"
 
gst-launch-1.0 rtpbin name=rtpbin latency=$LATENCY udpsrc caps=$VIDEO_CAPS port=5555 \
        ! rtpbin.recv_rtp_sink_0 \
        rtpbin. \
        ! $VIDEO_DEPAY \
        ! $VIDEO_DEC \
        ! $VIDEO_SINK

ds_akahane

2015年4月13日 15時25分

お教えいただき有難うございます。

お教えいただいた方法にてラグが解消することが確認できました。
こちらでは、受信側はWindowsですが同様にラグが0.5秒程になりました。

以上、よろしくお願いします。

> takahiro.nakamuraです。
>
> > ただ、2秒ほどのラグがあるのですがこれを解消する方法などありますでしょうか?
>
> ラグについてですが、Armadillo-810 (エンコード)よりは、再生(デコード)側に依存していると思われます。
>
> 圧縮率が低下しますが、acmh264encのProperties(max-gop-length,b-pic-mode等)を設定する事で、
> デコーダの遅延を多少抑える事が出来ると思います。
>

> gst-launch-1.0 -v \
>         v4l2src device=/dev/video1 \
>         ! video/x-raw,width=640,height=480,framerate=30/1 \
>         ! acmh264enc max-gop-length=1 b-pic-mode=0 bitrate=2000000 \
>         ! video/x-h264, stream-format=avc \
>         ! rtph264pay config-interval=3 \
>         ! udpsink force-ipv4=true port=5555 host=127.0.0.1
> 

>
> 弊社のArmadillo-840でデコードして確認した所、上記設定でのラグは0.5秒程度でした。
>
> なお、Armadillo-840(デコーダ)のパイプラインは以下です。
>

> VIDEO_CAPS=" application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
> VIDEO_DEPAY="rtph264depay ! h264parse"
> VIDEO_DEC="  acmh264dec buf-pic-cnt=3 stride=1920 ! video/x-raw,width=1920,height=1080"
> VIDEO_SINK=" acmfbdevsink device=/dev/fb0 max-lateness=2000000000"
> 
> gst-launch-1.0 rtpbin name=rtpbin latency=$LATENCY udpsrc caps=$VIDEO_CAPS port=5555 \
>         ! rtpbin.recv_rtp_sink_0 \
>         rtpbin. \
>         ! $VIDEO_DEPAY \
>         ! $VIDEO_DEC \
>         ! $VIDEO_SINK
>