- Newest
- Most votes
- Most comments
To address the issue of changing resolutions in your Kinesis Video Stream and the resulting "Codec changed" error, there are a few steps you can take:
-
Update codec private data (CPD): When the resolution changes, you need to update the codec private data in your stream. This can be done using the C producer library.
-
Use FragmentMetadata: Include updated codec information in the FragmentMetadata when you send a new fragment with changed resolution.
-
Implement adaptive bitrate streaming: Consider implementing adaptive bitrate streaming to handle resolution changes more smoothly.
Here's a general approach using the C producer library:
-
When your video resolution changes, create a new track with the updated resolution information.
-
Update the CPD for the new track:
STATUS updateCodecPrivateData(PKinesisVideoStream pKinesisVideoStream, PBYTE newCpd, UINT32 cpdSize) { STATUS retStatus = STATUS_SUCCESS; Frame frame; // Create a codec private data frame frame.frameData = newCpd; frame.size = cpdSize; frame.flags = FRAME_FLAG_KEY_FRAME | FRAME_FLAG_CODEC_CONFIG; frame.trackId = DEFAULT_VIDEO_TRACK_ID; frame.duration = 0; frame.decodingTs = GETTIME(); // Get current timestamp frame.presentationTs = frame.decodingTs; // Send the frame to update codec private data retStatus = putKinesisVideoFrame(pKinesisVideoStream, &frame); return retStatus; }
- After updating the CPD, send your new video frames with the updated resolution.
Remember to handle potential errors and implement proper error handling in your code. Also, ensure that your player is capable of handling resolution changes gracefully.
While this approach should help mitigate the issue, it's important to note that some players may still struggle with mid-stream resolution changes. In such cases, implementing server-side transcoding or using adaptive bitrate streaming might be necessary for a smoother viewing experience.
Sources
Use the C producer library - Amazon Kinesis Video Streams
PutMedia - Amazon Kinesis Video Streams
Relevant content
- asked 19 days ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 9 months ago
when i call above api on new sample codec change detect, it is giving error Fagment not able to decode in UI