diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 82c595f31..08307d281 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -567,8 +567,13 @@ void FFmpegReader::Open() { AVStream* st = pFormatCtx->streams[i]; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { // Only inspect the first video stream +#if (LIBAVFORMAT_VERSION_MAJOR < 62) for (int j = 0; j < st->nb_side_data; j++) { AVPacketSideData *sd = &st->side_data[j]; +#else + for (int j = 0; j < st->codecpar->nb_coded_side_data; j++) { + AVPacketSideData *sd = &st->codecpar->coded_side_data[j]; +#endif // Handle rotation metadata (unchanged) if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index 26379041e..20a6b16bb 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -1501,7 +1501,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVStream *st) { switch (video_codec_ctx->codec_id) { case AV_CODEC_ID_H264: video_codec_ctx->max_b_frames = 0; // At least this GPU doesn't support b-frames - video_codec_ctx->profile = FF_PROFILE_H264_BASELINE | FF_PROFILE_H264_CONSTRAINED; + video_codec_ctx->profile = AV_PROFILE_H264_BASELINE | AV_PROFILE_H264_CONSTRAINED; av_opt_set(video_codec_ctx->priv_data, "preset", "slow", 0); av_opt_set(video_codec_ctx->priv_data, "tune", "zerolatency", 0); av_opt_set(video_codec_ctx->priv_data, "vprofile", "baseline", AV_OPT_SEARCH_CHILDREN); @@ -2391,6 +2391,10 @@ void FFmpegWriter::AddSphericalMetadata(const std::string& projection, float yaw map->pitch = static_cast(pitch_deg * (1 << 16)); map->roll = static_cast(roll_deg * (1 << 16)); +#if (LIBAVFORMAT_VERSION_MAJOR < 62) av_stream_add_side_data(video_st, AV_PKT_DATA_SPHERICAL, reinterpret_cast(map), sd_size); +#else + av_packet_side_data_add(&video_st->codecpar->coded_side_data, &video_st->codecpar->nb_coded_side_data, AV_PKT_DATA_SPHERICAL, reinterpret_cast(map), sd_size, 0); +#endif #endif }