简体   繁体   English

gstreamer 到 Kinesis Video Stream 速率限制

[英]gstreamer to Kinesis Video Stream rate limiting

I am trying to send mkv file (see attributes below) to Kinesis Video Stream.我正在尝试将 mkv 文件(请参阅下面的属性)发送到 Kinesis Video Stream。 I would like to have FPS of 10-15 frames per second.我想要每秒 10-15 帧的 FPS。

> ffprobe testvideo02.mkv
...
Input #0, matroska,webm, from 'testvideo02.mkv':
  Metadata:
    ENCODER         : Lavf57.56.101
  Duration: 02:37:57.02, start: -0.007000, bitrate: 457 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 488x360 [SAR 1:1 DAR 61:45], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      HANDLER_NAME    : VideoHandler
      DURATION        : 02:37:57.000000000
    Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 02:37:57.021000000

To push stream to KVS I use GStreamer command-line from amazon-kinesis-video-streams-producer-sdk-cpp .要将流推送到 KVS,我使用来自amazon-kinesis-video-streams-producer-sdk-cpp GStreamer 命令行。 I used different keys, this is what I finally have and this does not work:我使用了不同的键,这是我终于拥有的,但它不起作用:

gst-launch-1.0 filesrc location=testvideo02.mkv do-timestamp=TRUE \
    ! matroskademux ! decodebin \
    ! videorate drop-only=true ! video/x-raw,framerate=15/1,max-rate=15/1 \
    ! videoconvert \
    ! x264enc bframes=0 key-int-max=45 bitrate=2048 \
    ! video/x-h264,framerate=15/1 \
    ! kvssink stream-name=$STREAM_NAME framerate=15 \
    access-key=$AWS_ACCESS_KEY secret-key=$AWS_SECRET_KEY


[DEBUG][2019-04-22 19:22:44] Kinesis Video client and stream metrics
        >> Overall storage byte size: 134217728
        >> Available storage byte size: 133001418
        >> Allocated storage byte size: 1216310
        >> Total view allocation byte size: 86472
        >> Total streams frame rate (fps): 163
        >> Total streams transfer rate (bps): 25683152 (25081 Kbps)
        >> Current view duration (ms): 720
        >> Overall view duration (ms): 6000
        >> Current view byte size: 187371
        >> Overall view byte size: 1211851
        >> Current frame rate (fps): 163.493
        >> Current transfer rate (bps): 25683152 (25081 Kbps)
[DEBUG][2019-04-22 19:22:44] Curl post body write function for stream: bc-test1 and upload handle: 0 returned: {"EventType":"PERSISTED","FragmentTimecode":21600,"FragmentNumber":"91343852333182571337132286426569376608263492193"}

on the client side (KVS consumer) from another server I have FPS over 80.在来自另一台服务器的客户端(KVS 消费者),我的 FPS 超过 80。

Question: How do I get FPS of 15?问题:如何获得 15 的 FPS?

And the worst issue: Every 1-1.5 seconds on consumer side I have about 1 sec "freeze" in data receiving.最糟糕的问题是:在消费者方面,每 1-1.5 秒我就会在数据接收中“冻结”大约 1 秒。 After that it receives whole data for that time and continues processing.之后,它会收到当时的全部数据并继续处理。 Cannot understand the root cause.无法理解根本原因。 Some buffers?一些缓冲区?

if you want to stream the file like a realtime source you can add "identity sync=TRUE" element to your pipeline.如果你想像实时源一样流式传输文件,你可以将“identity sync=TRUE”元素添加到你的管道中。 That means you will have to wait 15min to stream a 15min file.这意味着您必须等待 15 分钟才能流式传输 15 分钟的文件。 The best way to upload a file is to configure the kvssink plugin in offline mode like such:上传文件的最佳方式是在离线模式下配置 kvssink 插件,如下所示:

gst-launch-1.0 filesrc location=testvideo02.mkv do-timestamp=TRUE \
! matroskademux ! decodebin \
! videoconvert \
! x264enc bframes=0 key-int-max=45 bitrate=2048 \
! kvssink stream-name=$STREAM_NAME streaming-type=offline \
access-key=$AWS_ACCESS_KEY secret-key=$AWS_SECRET_KEY

The reason why you are seeing high fps is because without the identity sync=TRUE element, the pipeline is running at full cpu speed dumping frames into the plugin.您看到高 fps 的原因是因为没有 identity sync=TRUE 元素,管道以全 cpu 速度运行,将帧转储到插件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM