SrsEncoder video reconfigure on fly#836
Open
thegobot wants to merge 1 commit intobegeekmyfriend:masterfrom
Open
SrsEncoder video reconfigure on fly#836thegobot wants to merge 1 commit intobegeekmyfriend:masterfrom
thegobot wants to merge 1 commit intobegeekmyfriend:masterfrom
Conversation
If you reset MediaCodec in the middle of the stream, then the video freezes (artifacts) in the players. After the experiments, I seem to understand what the reason is. Not all predicred frames have time to be sent to the stream (the encoder stops). Therefore, first we complete the sending of all P-frames (this is signaled by the MediaCodec.BUFFER_FLAG_KEY_FRAME), then we reconfigure the encoder with new parameters.
Tested in latest Chrome and FF. The video now changes format and continues to play
Perhaps you will have other thoughts about this. Please give comments
ChunkDemuxer
Selected FFmpegAudioDecoder for audio decoding, config: codec: aac, profile: unknown, bytes_per_channel: 2, channel_layout: STEREO, channels: 2, samples_per_second: 44100, sample_format: Signed 16-bit, bytes_per_frame: 4, seek_preroll: 0us, codec_delay: 0, has extra data: false, encryption scheme: Unencrypted, discard decoder delay: false, target_output_channel_layout: STEREO, has aac extra data: true
Video rendering in low delay mode.
Failed to initialize DecryptingVideoDecoder
Effective playback rate changed from 0 to 1
Starting Initialization of DXVAVDA
Using D3D9 device for DXVA
Selected VDAVideoDecoder for video decoding, config: codec: h264, profile: h264 baseline, level: not available, alpha_mode: is_opaque, coded size: [480,640], visible rect: [0,0,480,640], natural size: [480,640], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
video decoder config changed midstream, new config: codec: h264, profile: h264 baseline, level: not available, alpha_mode: is_opaque, coded size: [1080,1920], visible rect: [0,0,1080,1920], natural size: [1080,1920], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
Failed to initialize VDAVideoDecoder
Failed to initialize DecryptingVideoDecoder
Failed to initialize VDAVideoDecoder
Failed to initialize VpxVideoDecoder
Failed to initialize Dav1dVideoDecoder
Selected FFmpegVideoDecoder for video decoding, config: codec: h264, profile: h264 baseline, level: not available, alpha_mode: is_opaque, coded size: [1080,1920], visible rect: [0,0,1080,1920], natural size: [1080,1920], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
Owner
|
I am afraid I am not sure whether shall I pick your commit into this project since there are other users using it. Maybe it is better you keep this feature for your own project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you reset MediaCodec in the middle of the stream, then the video freezes (artifacts) in the players. After the experiments, I seem to understand what the reason is. Not all predicred frames have time to be sent to the stream (the encoder stops). Therefore, first we complete the sending of all P-frames (this is signaled by the MediaCodec.BUFFER_FLAG_KEY_FRAME), then we reconfigure the encoder with new parameters.
Tested in latest Chrome and FF. The video now changes format and continues to play
Perhaps you will have other thoughts about this. Please give comments
ChunkDemuxer
Selected FFmpegAudioDecoder for audio decoding, config: codec: aac, profile: unknown, bytes_per_channel: 2, channel_layout: STEREO, channels: 2, samples_per_second: 44100, sample_format: Signed 16-bit, bytes_per_frame: 4, seek_preroll: 0us, codec_delay: 0, has extra data: false, encryption scheme: Unencrypted, discard decoder delay: false, target_output_channel_layout: STEREO, has aac extra data: true
Video rendering in low delay mode.
Failed to initialize DecryptingVideoDecoder
Effective playback rate changed from 0 to 1
Starting Initialization of DXVAVDA
Using D3D9 device for DXVA
Selected VDAVideoDecoder for video decoding, config: codec: h264, profile: h264 baseline, level: not available, alpha_mode: is_opaque, coded size: [480,640], visible rect: [0,0,480,640], natural size: [480,640], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
video decoder config changed midstream, new config: codec: h264, profile: h264 baseline, level: not available, alpha_mode: is_opaque, coded size: [1080,1920], visible rect: [0,0,1080,1920], natural size: [1080,1920], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
Failed to initialize VDAVideoDecoder
Failed to initialize DecryptingVideoDecoder
Failed to initialize VDAVideoDecoder
Failed to initialize VpxVideoDecoder
Failed to initialize Dav1dVideoDecoder
Selected FFmpegVideoDecoder for video decoding, config: codec: h264, profile: h264 baseline, level: not available, alpha_mode: is_opaque, coded size: [1080,1920], visible rect: [0,0,1080,1920], natural size: [1080,1920], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}