Reputation: 2999
I am trying to send mkv file (see attributes below) to Kinesis Video Stream. I would like to have FPS of 10-15 frames per second.
> 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
. 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.
Question: How do I get FPS of 15?
And the worst issue: Every 1-1.5 seconds on consumer side I have about 1 sec "freeze" in data receiving. After that it receives whole data for that time and continues processing. Cannot understand the root cause. Some buffers?
Upvotes: 1
Views: 1095
Reputation: 36
if you want to stream the file like a realtime source you can add "identity sync=TRUE" element to your pipeline. That means you will have to wait 15min to stream a 15min file. The best way to upload a file is to configure the kvssink plugin in offline mode like such:
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.
Upvotes: 1