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.

mpegtsmux choking bitrate of a pipeline

Other Parts Discussed in Thread: TVP5146

hi there !

i am  trying to encode a PAL video (576x720) from a composite source on my leopard board dm368 using ridgerun SDK. i am using DVSDK 04_02_00_06. i am running following pipeline

gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=6 ! 'video/x-raw-yuv, height=576, width=720, format=(fourcc)NV12' ! dmaiaccel ! queue ! dmaienc_h264 ratecontrol=2 encodingpreset=2 targetbitrate=6000000 maxbitrate=12500000 level=30 ! queue ! dmaiperf ! udpsink host =192.168.8.12 port=6666 sync=FALSE last-byte-enable=FALSE

 i am getting 25 frames as an output from this pipeline.

 

gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=6 ! 'video/x-raw-yuv, height=576, width=720, format=(fourcc)NV12', dmaiaccel ! queue ! dmaienc_h264 ratecontrol=2 encodingpreset=2 targetbitrate=6000000 maxbitrate=12500000 level=30 ! queue ! dmaiperf  ! mpegtsmux ! udpsink host =192.168.8.12 port=6666 sync=FALSE last-byte-enable=FALSE

but as soon as i bring mpegtsmux into the pipeline the frames are reduced to 13~14 frames per second.

please guide why the pipeline bitrate is being choked due to mpegtsmux and how can i remove it.

Asad

 

  • Hi Asad,


    It is drastic drop that is not expected only because of mpegtsmux , please add framerate part of your caps (25-30fps) . Why I suggest this there is possibility of drop in any of the elements in pipeline since muxer will be strict on caps. Please do check your CPU load in either of cases , just to eliminate doubt of mpegtsmux doing more that what is expected.

    Thanks  & Regards,

    Vishwanath Patil

  • thanks Vishwanath Patil,

    as you said, i executed following
    gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=6 ! 'video/x-raw-yuv, height=576, width=720, format=(fourcc)NV12, framerate=25/1' ! dmaiaccel ! queue ! dmaienc_h264 ratecontrol=2 encodingpreset=2 targetbitrate=6000000 maxbitrate
    queue ! dmaiperf print-arm-load=true ! udpsink host =192.168.8.12 port=6666 sync=FALSE

    and output was

    Timestamp: 0:30:40.036200262; bps: 0; fps: 0.0CPU: 20;
    INFO:
    Timestamp: 0:30:41.042818266; bps: 915904; fps: 27.83CPU: 31;
    INFO:
    Timestamp: 0:30:42.081311726; bps: 792199; fps: 25.4CPU: 27;
    INFO:
    Timestamp: 0:30:43.082474893; bps: 768294; fps: 24.97CPU: 27;
    INFO:
    Timestamp: 0:30:44.121160519; bps: 793752; fps: 25.4CPU: 26;
    INFO:
    Timestamp: 0:30:45.121196352; bps: 753041; fps: 25.0CPU: 27;
    INFO:
    Timestamp: 0:30:46.161295477; bps: 760304; fps: 25.0CPU: 26;
    INFO:
    Timestamp: 0:30:47.161629477; bps: 775192; fps: 25.0CPU: 27;
    INFO:
    Timestamp: 0:30:48.201452727; bps: 684037; fps: 25.2CPU: 25;
    INFO:
    Timestamp: 0:30:49.241161268; bps: 767527; fps: 25.2CPU: 26;
    INFO:
    Timestamp: 0:30:50.281099226; bps: 736149; fps: 25.2CPU: 27;
    INFO:
    Timestamp: 0:30:51.281743393; bps: 776923; fps: 25.0CPU: 28;
    INFO:
    Timestamp: 0:30:52.322030392; bps: 821547; fps: 25.0CPU: 26;
    INFO:
    Timestamp: 0:30:53.360652308; bps: 734000; fps: 25.4CPU: 25;
    INFO:
    Timestamp: 0:30:54.401917183; bps: 735879; fps: 24.97CPU: 25;

    it can be seen the CPU load is around 25 percent.

    later i brought mpegtsmux to th e pipeline and the cpu load rose at 100 %.

    gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=6 ! 'video/x-raw-yuv, height=576, width=720, format=(fourcc)NV12, framerate=25/1' ! dmaiaccel ! queue ! dmaienc_h264 ratecontrol=2 encodingpreset=2 targetbitrate=6000000 maxbitrate
    queue ! dmaiperf print-arm-load=true ! mpegtsmux ! udpsink host =192.168.8.12 port=6666 sync=FALSE
    Timestamp: 0:31:20.474591678; bps: 0; fps: 0.0CPU: 20;
    INFO:
    Timestamp: 0:31:21.494500144; bps: 309716; fps: 7.85CPU: 100;
    INFO:
    Timestamp: 0:31:22.501808478; bps: 362778; fps: 9.93CPU: 100;
    INFO:
    Timestamp: 0:31:23.556593146; bps: 399973; fps: 14.23CPU: 100;
    INFO:
    Timestamp: 0:31:24.622269688; bps: 400848; fps: 14.8CPU: 100;
    INFO:
    Timestamp: 0:31:25.647185063; bps: 386408; fps: 12.69CPU: 100;
    INFO:
    Timestamp: 0:31:26.742010063; bps: 271740; fps: 7.31CPU: 100;
    INFO:
    Timestamp: 0:31:27.791693396; bps: 255161; fps: 9.53CPU: 100;
    INFO:
    Timestamp: 0:31:28.915096018; bps: 200795; fps: 7.12CPU: 100;
    INFO:
    Timestamp: 0:31:29.925275935; bps: 263110; fps: 7.92CPU: 100;
    INFO:
    Timestamp: 0:31:31.031480772; bps: 230718; fps: 8.13CPU: 100;
    INFO:
    Timestamp: 0:31:32.131945939; bps: 203615; fps: 7.27CPU: 100;
    INFO:
    Timestamp: 0:31:33.134023148; bps: 247527; fps: 7.98CPU: 100;
    INFO:
    Timestamp: 0:31:34.183609314; bps: 259404; fps: 5.71CPU: 100;
    INFO:
    Timestamp: 0:31:35.303858979; bps: 218963; fps: 8.3CPU: 100;
    INFO:
    Timestamp: 0:31:36.426437353; bps: 220148; fps: 8.2CPU: 100;
    ^CCaught interrupt -- handling interrupt.
    Interrupt: Stopping pipeline ...
    EOS on shutdown enabled -- Forcing EOS on the pipeline
    Waiting for EOS...
    INFO:
    Timestamp: 0:31:37.462853852; bps: 274028; fps: 6.75CPU: 100;
    INFO:
    Timestamp: 0:31:38.574681187; bps: 227660; fps: 5.40CPU: 100;


    FYI, i am running ridgerun default image of kernel provided by ridgerun SDK and booting my leopard board from SD card.

    Asad
  • Hi Asad,

    Please share gstreamer version that your using . As I could quickly see there are bugs of mpegtsmux with performance issues https://lists.freedesktop.org/archives/gstreamer-bugs .

    1) Do try with avimux once , even though avimux has less headers , All Muxers uses collectpads to collect data which would involve an additional copy and accumulate , later you can analyze mpegtsmux plugin in detail if issue doesn't exist with avimux(gst-good) .

    2) In CodecParams you can set TargetFramerate to 10 and caps to 10 and then just check atleast with 10 fps are you getting desired bitrate , if so you can repeat same with 15fps.

    I assume DM368 is running at ARM-432 , DDR - 343.

    Thanks & Regards,

    Vishwanath Patil

  • hi  Patil,

    I executed following to find the gstreamer version

    / # gst-launch --version

    gst-launch-0.10 version 0.10.32

    GStreamer 0.10.32

    Unknown package origin

    tried same pipeline as you suggested with avimux and it was giving following results

    # vi abc

    gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=3 ! 'video/x-raw-yuv, height=576, width=720, format=(fourcc)NV12, pitch=736, framerate=25/1'! dmaiaccel ! dmaiperf print-arm-load=true ! queue ! dmaienc_h264 targetbitrate= 8000000 maxbitrate=8000000 ratecontrol=2 encodingpreset=2 single-nalu=true ! queue ! avimux ! udpsink host=199.200.15.61 port=6666 enable-last-buffer=TRUE

    ./abc

    # ./abc

    Setting pipeline to PAUSED ...

    davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:124

    vpfe-capture vpfe-capture: IPIPE Chained

    vpfe-capture vpfe-capture: Resizer present

    Pipeline is live and does not need PREROLL ...

    WARNING: from element /GstPipeline:pipeline0/GstDmaiperf:dmaiperf0: Could not get/set settings from/on resource.

    Additional debug info:

    ../../src/src/gsttidmaiperf.c(273): gst_dmaiperf_start (): /GstPipeline:pipeline0/GstDmaiperf:dmaiperf0:

    Engine name not specified, not printing DSP information

    WARNING: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Video input device did not accept new frame rate setting.

    Additional debug info:

    ../../../src/sys/v4l2/v4l2src_calls.c(342): gst_v4l2src_set_capture (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:

    system error: Invalid argument

    Setting pipeline to PLAYING ...

    New clock: GstSystemClock

    INFO:

    Timestamp: 0:03:11.933006093; bps: 0; fps: 0.0CPU: 6;

    INFO:

    Timestamp: 0:03:12.963839055; bps: 14199798; fps: 22.33CPU: 17;

    INFO:

    Timestamp: 0:03:14.003802932; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:15.043766099; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:16.083773225; bps: 15897600; fps: 25.0CPU: 0;

    INFO:

    Timestamp: 0:03:17.123733349; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:18.163717850; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:19.203700224; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:20.243680349; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:21.283665974; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:22.323645140; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:23.363614931; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:24.363616014; bps: 15897600; fps: 25.0CPU: 1;

    INFO:

    Timestamp: 0:03:25.403581889; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:26.443556639; bps: 15912900; fps: 25.2CPU: 1;

    INFO:

    Timestamp: 0:03:27.483526891; bps: 15912900; fps: 25.2CPU: 0;

    INFO:

    Timestamp: 0:03:28.523531309; bps: 15897600; fps: 25.0CPU: 0;

    INFO:

    Timestamp: 0:03:29.563517684; bps: 15912900; fps: 25.2CPU: 0;

    i tried to reduce the framerate but failed to do so

    vi abc

    gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=3 ! 'vdeo/x-raw-yuv, height=576, width=720, format=(fourcc)NV12, pitch=736, framerate=10/1'! dmaiaccel ! dmaiperf print-arm-load=true ! queue ! dmaienc_h264 targetbitrate= 8000000 maxbitrate=8000000 ratecontrol=2 encodingpreset=2 single-nalu=true ! queue ! mpegtsmux ! udpsink host=199.200.15.61 port=6666 enable-last-buffer=TRUE

    ./abc

    Setting pipeline to PAUSED ...

    davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:124

    vpfe-capture vpfe-capture: IPIPE Chained

    vpfe-capture vpfe-capture: Resizer present

    tvp514x 1-005d: tvp5146 (Version - 0x03) found at 0xba (DaVinci I2C adapter)

    ERROR: Pipeline doesn't want to pause.

    WARNING: from element /GstPipeline:pipeline0/GstDmaiperf:dmaiperf0: Could not get/set settings from/on resource.

    Additional debug info:

    ../../src/src/gsttidmaiperf.c(273): gst_dmaiperf_start (): /GstPipeline:pipeline0/GstDmaiperf:dmaiperf0:

    Engine name not specified, not printing DSP information

    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not negotiate format

    Additional debug info:

    ../../../../src/libs/gst/base/gstbasesrc.c(2778): gst_base_src_start (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:

    Check your filtered caps, if any

    Setting pipeline to NULL ...

    Freeing pipeline ...

    please guide.

    Asad

  • Hi Asad,

    Keep rest of parameter same across all your experiments (like queue-size) , if you see with avimux your getting better performance . It is time to go through mpegtsmux plugin (profile). Parallely I will try to explore mpegtsmux what is key difference with avimux, If I have any key debug points I will share with you.

    You might not be able to try all the framerate because of v4l2 device(since it depends on hardware capabilities I suppose ).
  • In response to above problem,

    i tried below mentioned piepline,

    gst-launch -e v4l2src input-src=composite always-copy=FALSE queue-size=3 ! 'video/x-raw-yuv, height=576, width=720, format=(fourcc)NV12, pitch=736, framerate=25/1'! dmaiaccel ! dmaiperf print-arm-load=true ! queue ! dmaienc_h264 targetbitrate= 8000000 maxbitrate=8000000 ratecontrol=2 encodingpreset=2 single-nalu=true ! queue ! rtph264pay ! udpsink host=199.200.15.61 port=6666 enable-last-buffer=TRUE

    The pipeline works perfectly fine without any delay or packet loss, so it seems the problem was with mpegtsmux. 

    in addition to above, i have a question about the quality of the video. please check the image below 

    edges are not sharped . which properties control edges? is the codec dmai_ench264 encodes frames or fields (even odd fields of 575i) ? 

    i am using sdp file to stream video in VLC. VLC is not showing frames per second received in codec and statistics setting. 

    i need 25 frames per second but i doubt i am receiving frames or fields?

    Asad