Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send rtmp to Kinesis Video Streams? #1212

Open
swift1688 opened this issue Dec 13, 2024 · 1 comment
Open

How to send rtmp to Kinesis Video Streams? #1212

swift1688 opened this issue Dec 13, 2024 · 1 comment
Labels

Comments

@swift1688
Copy link

The video stream is stored in srs, I use ffmpeg to push the video stream in srs to Kinesis Video Streams by kvs_gstreamer_sample
shell : ffmpeg -i rtmp://127.0.0.1:1935/live/php_klk_nttt_00001 -c:v copy -f matroska - | ./kvs_gstreamer_sample php_klk_nttt_00001

logs:

[INFO ] [13-12-2024 17:15:08:624.077 GMT] Using region: ap-east-1
[INFO ] [13-12-2024 17:15:08:624.131 GMT] Using aws credentials for Kinesis Video Streams
[INFO ] [13-12-2024 17:15:08:624.144 GMT] No session token was detected.
[INFO ] [13-12-2024 17:15:08:625.006 GMT] createKinesisVideoClient(): Creating Kinesis Video Client
[WARN ] [13-12-2024 17:15:08:625.051 GMT] fixupClientInfo(): Connection timeout is invalid...setting to default
[WARN ] [13-12-2024 17:15:08:625.061 GMT] fixupClientInfo(): Completion timeout is invalid...setting to default
[INFO ] [13-12-2024 17:15:08:625.081 GMT] heapInitialize(): Initializing native heap with limit size 134217728, spill ratio 0% and flags 0x00000001
[INFO ] [13-12-2024 17:15:08:625.099 GMT] heapInitialize(): Creating AIV heap.
[INFO ] [13-12-2024 17:15:08:625.119 GMT] heapInitialize(): Heap is initialized OK
[DEBUG] [13-12-2024 17:15:08:625.202 GMT] getSecurityTokenHandler invoked
[DEBUG] [13-12-2024 17:15:08:625.221 GMT] Refreshing credentials. Force refreshing: 0 Now time is: 1734110108625215590 Expiration: 0
[INFO ] [13-12-2024 17:15:08:625.231 GMT] New credentials expiration is 1734113708
[INFO ] [13-12-2024 17:15:08:625.254 GMT] createDeviceResultEvent(): Create device result event.
[DEBUG] [13-12-2024 17:15:08:625.265 GMT] clientReadyHandler invoked
[DEBUG] [13-12-2024 17:15:08:625.276 GMT] Client is ready
[INFO ] [13-12-2024 17:15:08:625.296 GMT] Creating Kinesis Video Stream php_klk_nttt_00001
[INFO ] [13-12-2024 17:15:08:625.307 GMT] createKinesisVideoStream(): Creating Kinesis Video Stream.
[INFO ] [13-12-2024 17:15:08:625.316 GMT] logStreamInfo(): SDK version: 7acf272
[DEBUG] [13-12-2024 17:15:08:625.324 GMT] logStreamInfo(): Kinesis Video Stream Info
[DEBUG] [13-12-2024 17:15:08:625.334 GMT] logStreamInfo(): Stream name: php_klk_nttt_00001
[DEBUG] [13-12-2024 17:15:08:625.343 GMT] logStreamInfo(): Streaming type: STREAMING_TYPE_REALTIME
[DEBUG] [13-12-2024 17:15:08:625.353 GMT] logStreamInfo(): Content type: video/h264
[DEBUG] [13-12-2024 17:15:08:625.362 GMT] logStreamInfo(): Max latency (100ns): 600000000
[DEBUG] [13-12-2024 17:15:08:625.372 GMT] logStreamInfo(): Fragment duration (100ns): 20000000
[DEBUG] [13-12-2024 17:15:08:625.381 GMT] logStreamInfo(): Key frame fragmentation: Yes
[DEBUG] [13-12-2024 17:15:08:625.390 GMT] logStreamInfo(): Use frame timecodes: Yes
[DEBUG] [13-12-2024 17:15:08:625.399 GMT] logStreamInfo(): Absolute frame timecodes: Yes
[DEBUG] [13-12-2024 17:15:08:625.409 GMT] logStreamInfo(): Nal adaptation flags: 0
[DEBUG] [13-12-2024 17:15:08:625.418 GMT] logStreamInfo(): Average bandwidth (bps): 4194304
[DEBUG] [13-12-2024 17:15:08:625.427 GMT] logStreamInfo(): Framerate: 25
[DEBUG] [13-12-2024 17:15:08:625.436 GMT] logStreamInfo(): Buffer duration (100ns): 1200000000
[DEBUG] [13-12-2024 17:15:08:625.445 GMT] logStreamInfo(): Replay duration (100ns): 400000000
[DEBUG] [13-12-2024 17:15:08:625.454 GMT] logStreamInfo(): Connection Staleness duration (100ns): 600000000
[DEBUG] [13-12-2024 17:15:08:625.464 GMT] logStreamInfo(): Store Pressure Policy: 1
[DEBUG] [13-12-2024 17:15:08:625.473 GMT] logStreamInfo(): View Overflow Policy: 1
[DEBUG] [13-12-2024 17:15:08:625.482 GMT] logStreamInfo(): Allow stream creation: Yes
[DEBUG] [13-12-2024 17:15:08:625.490 GMT] logStreamInfo(): Segment UUID: NULL
[DEBUG] [13-12-2024 17:15:08:625.500 GMT] logStreamInfo(): Frame ordering mode: 0
[DEBUG] [13-12-2024 17:15:08:625.508 GMT] logStreamInfo(): Track list
[DEBUG] [13-12-2024 17:15:08:625.518 GMT] logStreamInfo(): Track id: 1
[DEBUG] [13-12-2024 17:15:08:625.526 GMT] logStreamInfo(): Track name: kinesis_video
[DEBUG] [13-12-2024 17:15:08:625.536 GMT] logStreamInfo(): Codec id: V_MPEG4/ISO/AVC
[DEBUG] [13-12-2024 17:15:08:625.545 GMT] logStreamInfo(): Track type: TRACK_INFO_TYPE_VIDEO
[DEBUG] [13-12-2024 17:15:08:625.554 GMT] logStreamInfo(): Track cpd: NULL
[DEBUG] [13-12-2024 17:15:08:625.629 GMT] setRequestHeader(): Appending header to request: user-agent -> AWS-SDK-KVS/1.5.3 GCC/9.4.0 Linux/5.4.0-190-generic x86_64 CPPSDK
[DEBUG] [13-12-2024 17:15:08:625.728 GMT] setRequestHeader(): Appending header to request: host -> kinesisvideo.ap-east-1.amazonaws.com/describeStream
[DEBUG] [13-12-2024 17:15:08:625.775 GMT] setRequestHeader(): Appending header to request: X-Amz-Date -> 20241213T171508Z
[DEBUG] [13-12-2024 17:15:08:625.788 GMT] setRequestHeader(): Appending header to request: content-type -> application/json
[DEBUG] [13-12-2024 17:15:08:625.800 GMT] setRequestHeader(): Appending header to request: content-length -> 39
[DEBUG] [13-12-2024 17:15:08:625.851 GMT] setRequestHeader(): Appending header to request: Authorization -> AWS4-HMAC-SHA256 Credential=AKIAQE43J64TOASVAVKW/20241213/ap-east-1/kinesisvideo/aws4_request, SignedHeaders=host;user-agent;x-amz-date, Signature=6a39ec1da2a2cdae08963b13a14fc924620f17ce9776f7214326c798f5d819b2
[INFO ] [13-12-2024 17:15:08:650.770 GMT] writeHeaderCallback(): RequestId: 89a9a893-2633-4c1b-9fa7-82a5268537eb
[DEBUG] [13-12-2024 17:15:08:650.853 GMT] describeStreamCurlHandler(): [php_klk_nttt_00001] DescribeStream API response: {"StreamInfo":{"CreationTime":1.733225318722E9,"DataRetentionInHours":24,"DeviceName":null,"IngestionConfiguration":null,"KmsKeyId":"arn:aws:kms:ap-east-1:010526258982:alias/aws/kinesisvideo","MediaType":null,"Status":"ACTIVE","StreamARN":"arn:aws:kinesisvideo:ap-east-1:010526258982:stream/php_klk_nttt_00001/1733225318722","StreamName":"php_klk_nttt_00001","Version":"Eg6BOwASoFSpRB4WtPXU"}}
[INFO ] [13-12-2024 17:15:08:651.651 GMT] describeStreamResultEvent(): Describe stream result event.
[WARN ] [13-12-2024 17:15:08:651.674 GMT] describeStreamResult(): Retention period returned from the DescribeStream call doesn't match the one specified in the StreamInfo
[WARN ] [13-12-2024 17:15:08:651.687 GMT] describeStreamResult(): Content type returned from the DescribeStream(null) call doesn't match the one specified in the StreamInfo(video/h264)
[WARN ] [13-12-2024 17:15:08:651.697 GMT] describeStreamResult(): [php_klk_nttt_00001] Retention period returned from the DescribeStream call doesn't match the one specified in the StreamInfo
[WARN ] [13-12-2024 17:15:08:651.708 GMT] describeStreamResult(): [php_klk_nttt_00001] Content type returned from the DescribeStream call doesn't match the one specified in the StreamInfo
[DEBUG] [13-12-2024 17:15:08:651.932 GMT] setRequestHeader(): Appending header to request: user-agent -> AWS-SDK-KVS/1.5.3 GCC/9.4.0 Linux/5.4.0-190-generic x86_64 CPPSDK
[DEBUG] [13-12-2024 17:15:08:652.011 GMT] setRequestHeader(): Appending header to request: host -> kinesisvideo.ap-east-1.amazonaws.com/getDataEndpoint
[DEBUG] [13-12-2024 17:15:08:652.043 GMT] setRequestHeader(): Appending header to request: X-Amz-Date -> 20241213T171508Z
[DEBUG] [13-12-2024 17:15:08:652.056 GMT] setRequestHeader(): Appending header to request: content-type -> application/json
[DEBUG] [13-12-2024 17:15:08:652.066 GMT] setRequestHeader(): Appending header to request: content-length -> 64
[DEBUG] [13-12-2024 17:15:08:652.102 GMT] setRequestHeader(): Appending header to request: Authorization -> AWS4-HMAC-SHA256 Credential=AKIAQE43J64TOASVAVKW/20241213/ap-east-1/kinesisvideo/aws4_request, SignedHeaders=host;user-agent;x-amz-date, Signature=df8380df174d5f7ef4afa55c6f3d9dba43111b6c3c14aa48b96f019b3413d0b9
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[INFO ] [13-12-2024 17:15:08:674.473 GMT] writeHeaderCallback(): RequestId: 85879c71-223c-433c-9c00-5a141bb2f10e
[DEBUG] [13-12-2024 17:15:08:674.513 GMT] getStreamingEndpointCurlHandler(): [php_klk_nttt_00001] GetStreamingEndpoint API response: {"DataEndpoint":"https://s-24c98279.kinesisvideo.ap-east-1.amazonaws.com"}
[INFO ] [13-12-2024 17:15:08:675.037 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event.
[DEBUG] [13-12-2024 17:15:08:675.065 GMT] getStreamingTokenHandler invoked
[DEBUG] [13-12-2024 17:15:08:675.076 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1734110108675074587 Expiration: 1734113708
[INFO ] [13-12-2024 17:15:08:675.082 GMT] New credentials expiration is 1734113708
[INFO ] [13-12-2024 17:15:08:675.099 GMT] getStreamingTokenResultEvent(): Get streaming token result event.
[DEBUG] [13-12-2024 17:15:08:675.128 GMT] streamReadyHandler invoked
[DEBUG] [13-12-2024 17:15:08:675.177 GMT] Stream is ready
[INFO ] [13-12-2024 17:15:08:684.589 GMT] Streaming from live source
[DEBUG] [13-12-2024 17:15:08:684.644 GMT] Streaming with live source and width: 0, height: 0, fps: 25, bitrateInKBPS512
[DEBUG] [13-12-2024 17:15:08:686.292 GMT] Using x264enc
[DEBUG] [13-12-2024 17:15:08:687.527 GMT] Using v4l2src
Unable to set the source to ready state.
[ERROR] [13-12-2024 17:15:08:687.590 GMT] Failed to initialize gstreamer
[INFO ] [13-12-2024 17:15:08:687.615 GMT] Freeing Kinesis Video Stream for php_klk_nttt_00001
[INFO ] [13-12-2024 17:15:08:687.631 GMT] freeKinesisVideoStream(): Freeing Kinesis Video stream.
[DEBUG] [13-12-2024 17:15:08:687.641 GMT] freeStream(): [php_klk_nttt_00001] Freeing stream
[DEBUG] [13-12-2024 17:15:08:687.654 GMT] curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty
[DEBUG] [13-12-2024 17:15:09:087.888 GMT] freeStream(): [php_klk_nttt_00001] Completed freeing stream
[INFO ] [13-12-2024 17:15:09:087.943 GMT] Completed freeing stream php_klk_nttt_00001
[INFO ] [13-12-2024 17:15:09:087.967 GMT] Freeing Kinesis Video Stream for php_klk_nttt_00001
[INFO ] [13-12-2024 17:15:09:087.979 GMT] freeKinesisVideoClient(): Freeing Kinesis Video Client
[DEBUG] [13-12-2024 17:15:09:087.993 GMT] curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty
[DEBUG] [13-12-2024 17:15:09:488.216 GMT] freeKinesisVideoClientInternal(): Total allocated memory 0
[INFO ] [13-12-2024 17:15:09:488.256 GMT] Completed freeing client
[WARN ] [13-12-2024 17:15:09:488.281 GMT] curlApiCallbacksShutdown(): curlApiCallbacksShutdown called when already in progress of shutting down
Input #0, flv, from 'rtmp://127.0.0.1:1935/live/php_klk_nttt_00001':
Metadata:
title : Media Presentation
comment : samsung
encoder : Lavf58.76.100
server : SRS/5.0.212(Bee)
server_version : 5.0.212
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Data: none
Stream #0:1: Video: h264 (High), yuvj420p(pc, progressive), 640x360, 30 tbr, 1k tbn
Could not write header for output file #0 (incorrect codec parameters ?): Broken pipe
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Last message repeated 1 times

What should i do? Thks!

@sirknightj sirknightj changed the title rtmp stream cannot be pushed How to send rtmp to Kinesis Video Streams? Dec 13, 2024
@sirknightj
Copy link
Contributor

Seems to be a duplicate of: #197 (comment)

Use rtmpsrc wth kvssink.

kvs_gstreamer_sample doesn't support what you're trying to do. kvs_gstreamer_sample currently only supports v4l2 and rtsp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants