Migration API FFmpeg 6.0+ (codecpar/AVBSFContext) : tested for compatibility FFmpeg 8.0/8.1 (PR v2)#2
Open
M2G wants to merge 2 commits into
Open
Migration API FFmpeg 6.0+ (codecpar/AVBSFContext) : tested for compatibility FFmpeg 8.0/8.1 (PR v2)#2M2G wants to merge 2 commits into
M2G wants to merge 2 commits into
Conversation
…vement) and remove unused code
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.
Background
The
segmentpackage was still using the old FFmpeg 2.x API (AVStream->codec,AVBitStreamFilterContext,av_register_all(),av_free_packet()...), which was deprecated and thenremoved in recent versions of FFmpeg.
This fork migrates the code to the modern API, which has been stable since FFmpeg 6.0 and has been verified as compatible up to FFmpeg 8.
Changes
AVStream->codectoAVStream->codecpar: Copy parameters usingavcodec_parameters_copy()instead of manually setting each field (codec_type, bit_rate,extradata, channel_layout, etc.)
AVBitStreamFilterContexttoAVBSFContext: Replacesav_bitstream_filter_init()/av_bitstream_filter_filter()withav_bsf_alloc()/av_bsf_init()/av_bsf_send_packet()/av_bsf_receive_packet()AVPacketon the stack toav_packet_alloc()/av_packet_free(): Replaces the oldav_free_packet()(removed since FFmpeg 4.0)avformat_alloc_context()+av_guess_format()toavformat_alloc_output_context2()av_register_all()(no-op since FFmpeg 4.0)CODEC_FLAG_GLOBAL_HEADERand theCODEC_ID_MP3/CODEC_ID_AC3switch(automatically handled by
avcodec_parameters_copy)#cgo LDFLAGS/CFLAGS(path/root/ffmpeg_build) replacedwith
#cgo pkg-config: libavformat libavcodec libavutil, for a portable build withoutpath changes across environments
first_frame_sec, assigned but never read)Tests performed
gcc -Wall -Wextra, 0 warnings) against FFmpeg 8.0 compiled fromsource (libavcodec 62 / libavformat 62)
pkg-config4-second
.tssegments + valid.m3u8playlist; each segment validated withffprobeCompatibility
Linux and macOS (Apple Silicon), FFmpeg 6.0 through 8.1, without platform-specific code
thanks to
pkg-config.