On Wed, May 14, 2025 at 1:31 PM Andrew Randrianasulu <randrianas...@gmail.com> wrote: > > So I was experimenting with Vulkan decoding in cinelerra-gg. > > After some fight I get build using ffmpeg git > > commit 038314bc6be2f35a82e9fba2228bcac2e4fee648 for ffmpeg > > here is bunch of errors like this: > > [hevc @ 0x6f7465c0] Could not find ref with POC 296 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 9 > [hevc @ 0x6f72ad00] Could not find ref with POC 296 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 8 > [hevc @ 0x6f77b3c0] Could not find ref with POC 298 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 8 > [hevc @ 0x6f789480] Could not find ref with POC 300 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 300 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 300 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 302 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 304 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 304 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 304 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 306 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 308 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 308 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 308 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 310 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 312 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 312 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 312 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 314 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 316 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 316 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 316 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 318 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 320 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 320 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 320 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 322 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 324 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 324 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 324 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 326 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 328 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 328 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > [hevc @ 0x6f72ad00] Could not find ref with POC 328 > [hevc @ 0x6f72ad00] Error constructing the frame RPS. > [hevc @ 0x6f72ad00] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f77b3c0] Could not find ref with POC 330 > [hevc @ 0x6f77b3c0] Error constructing the frame RPS. > [hevc @ 0x6f77b3c0] Skipping invalid undecodable NALU: 2 > [hevc @ 0x6f789480] Could not find ref with POC 332 > [hevc @ 0x6f789480] Error constructing the frame RPS. > [hevc @ 0x6f789480] Skipping invalid undecodable NALU: 1 > [hevc @ 0x6f7465c0] Could not find ref with POC 332 > [hevc @ 0x6f7465c0] Error constructing the frame RPS. > [hevc @ 0x6f7465c0] Skipping invalid undecodable NALU: 3 > > file itself: > https://drive.google.com/file/d/1Ic9DZXMSo07EJMqCFaQRKSSrSw6y1mYv/view > > But I see some kind of first frame corruption I never saw on 7.0 build > > https://paste.pics/860707666060d195485e07ea7b057ce8 > > and speed kinda down from 58 fps to just 50-51 relative to ffmpeg libs 7.0? > > hw: > 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. > [AMD/ATI] Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] (rev > c7) > > mesa: > > OpenGL renderer string: AMD Radeon RX 550 / 550 Series (radeonsi, > polaris12, ACO, DRM 3.61, 6.12.26-x64) > OpenGL core profile version string: 4.6 (Core Profile) Mesa > 25.2.0-devel (git-ef63e3e4d2) > > cingg home git: > git://git.cinelerra-gg.org/goodguy/cinelerra.git > > I set two evn. variables specific to my system, but mostly I wanted to > get libplacebo and libzimg for HDR->SDR conversion > > EXTRA_LIBS := -lOpenCL -lSvtAv1Enc -lvpl -ldav1d -lxvidcore -lass > -lbluray -lsnappy -lzimg -lplacebo -lshaderc_shared -lnuma -lva > -lva-x11 `pkg-config --libs x11` -lva-drm -ldl > FFMPEG_EXTRA_CFG := --enable-libvpl --disable-doc --enable-opencl > --enable-libsvtav1 --enable-frei0r --enable-libdav1d --enable-libzimg > --enable-libxvid --enable-libass --enable-libbluray --enable-libsnappy > --enable-libshaderc --enable-libplacebo --enable-vulkan > --disable-debug --extra-cflags=-I/usr/local/include/vpl > --extra-cflags=-I/usr/include/svt-av1 --extra-ldflags=" -lva > `pkg-config --libs libva` -lva-x11 -lva-drm -ldl" > > > cingg configure: > > ./configure --with-git-ffmpeg=https://git.ffmpeg.org/ffmpeg.git > --with-single-user --enable-libsvtav1 --disable-dav1d > > I used bunch of patches (attached, done by Phyllis and me) and > manually removed posprocess.a ref. from our configure.ac for now
One more patch/hack just for making building easier attached (on top of 0001-3 patches for cingg) ffmpeg.git patches go into thirdparty/src, and you probably want to move away ffmpeg.git.patch8 out of this directory so it will not fail patching > > there is still some problem with attaching ffmpeg filters > per-input-file, but main Vulkan decode problem still visible without > any filters > > I run just-compiled cin binary like this: > > RADV_PERFTEST=video_decode bin/cin > ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov > > and got corruption as visible on screenshot at the start of this email > > Playing image forward cleans up this corruption, but returning to > timeline beginning bring it back.
From a5a935b7847690088c594d7785e10abefdf303c6 Mon Sep 17 00:00:00 2001 From: Andrew Randrianasulu <randrianas...@gmail.com> Date: Wed, 14 May 2025 13:42:34 +0300 Subject: [PATCH 4/4] HACK ffmpeg 8.0 build --- cinelerra-5.1/cinelerra/bdwrite.C | 6 ++++ cinelerra-5.1/cinelerra/ffmpeg.C | 53 ++++++++++++++++++++++++++++--- cinelerra-5.1/cinelerra/fileac3.C | 2 ++ cinelerra-5.1/configure.ac | 1 - 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C index 1f7f027e..1b027a7f 100644 --- a/cinelerra-5.1/cinelerra/bdwrite.C +++ b/cinelerra-5.1/cinelerra/bdwrite.C @@ -2586,7 +2586,11 @@ static int field_probe(AVFormatContext *fmt_ctx, AVStream *st) } ret = avcodec_receive_frame(ctx, ipic); if( ret >= 0 ) { +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) ilaced = ipic->interlaced_frame ? 1 : 0; +#else + ilaced = ipic->flags & AV_FRAME_FLAG_INTERLACED ? 1 : 0; +#endif break; } if( ret != AVERROR(EAGAIN) ) @@ -2769,7 +2773,9 @@ int media_info::scan() ret = scan(fmt_ctx); for( int i=0; i<(int)streams.size(); ++i ) +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) avcodec_close(streams[i]->ctx); +#endif avformat_close_input(&fmt_ctx); return ret; diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 00b02791..683bff94 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -310,7 +310,9 @@ FFStream::FFStream(FFMPEG *ffmpeg, AVStream *st, int fidx) FFStream::~FFStream() { frm_lock->lock("FFStream::~FFStream"); +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) if( reading > 0 || writing > 0 ) avcodec_close(avctx); +#endif if( avctx ) avcodec_free_context(&avctx); if( fmt_ctx ) avformat_close_input(&fmt_ctx); if( hw_device_ctx ) av_buffer_unref(&hw_device_ctx); @@ -475,7 +477,9 @@ int FFStream::decode_activate() if( ret < 0 && hw_type != AV_HWDEVICE_TYPE_NONE ) { ff_err(ret, "HW device init failed, using SW decode.\nfile:%s\n", ffmpeg->fmt_ctx->url); +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) avcodec_close(avctx); +#endif avcodec_free_context(&avctx); av_buffer_unref(&hw_device_ctx); hw_device_ctx = 0; @@ -1305,7 +1309,7 @@ int FFVideoStream::probe(int64_t pos) if( ret > 0 ) { //printf("codec interlace: %i \n",frame->interlaced_frame); //printf("codec tff: %i \n",frame->top_field_first); - +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) if (!frame->interlaced_frame) ffmpeg->interlace_from_codec = AV_FIELD_PROGRESSIVE; if ((frame->interlaced_frame) && (frame->top_field_first)) @@ -1313,7 +1317,14 @@ int FFVideoStream::probe(int64_t pos) if ((frame->interlaced_frame) && (!frame->top_field_first)) ffmpeg->interlace_from_codec = AV_FIELD_BB; //printf("Interlace mode from codec: %i\n", ffmpeg->interlace_from_codec); - +#esle + if (!frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) + ffmpeg->interlace_from_codec = AV_FIELD_PROGRESSIVE; + if ((frame->flags & AV_FRAME_FLAG_INTERLACED) && (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) + ffmpeg->interlace_from_codec = AV_FIELD_TT; + if ((frame->flags & AV_FRAME_FLAG_INTERLACED ) && (!frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST)) + ffmpeg->interlace_from_codec = AV_FIELD_BB; +#endif } if( frame->format == AV_PIX_FMT_NONE || frame->width <= 0 || frame->height <= 0 ) @@ -1339,7 +1350,11 @@ int FFVideoStream::load(VFrame *vframe, int64_t pos) while( ret>=0 && !flushed && curr_pos<=pos && --i>=0 ) { ret = read_frame(frame); if( ret > 0 ) { +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) if( frame->key_frame && seeking < 0 ) { +#else + if( (frame->flags & AV_FRAME_FLAG_KEY) && seeking < 0 ) { +#endif int use_cache = ffmpeg->get_use_cache(); if( use_cache < 0 ) { // for reverse read, reload file frame_cache from keyframe to pos @@ -1511,8 +1526,15 @@ int FFVideoStream::drain() int FFVideoStream::encode_frame(AVFrame *frame) { if( frame ) { +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) frame->interlaced_frame = interlaced; frame->top_field_first = top_field_first; +#else + if(top_field_first) + frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; + if(interlaced) + frame->flags |= AV_FRAME_FLAG_INTERLACED; +#endif } if( frame && frame->format == AV_PIX_FMT_VAAPI ) { // ugly int ret = avcodec_send_frame(avctx, frame); @@ -3846,7 +3868,20 @@ double FFVideoStream::get_rotation_angle() #else int size = 0; #endif + +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) int *matrix = (int*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &size); +#else + int32_t *matrix = NULL; + if (!matrix) { + const AVPacketSideData *psd = av_packet_side_data_get(st->codecpar->coded_side_data, + st->codecpar->nb_coded_side_data, + AV_PKT_DATA_DISPLAYMATRIX); + if (psd) + matrix = (int32_t *)psd->data; + } + +#endif int len = size/sizeof(*matrix); if( !matrix || len < 5 ) return 0; const double s = 1/65536.; @@ -3904,7 +3939,7 @@ int FFVideoStream::create_filter(const char *filter_spec) *np = 0; const AVFilter *filter = !filter_name[0] ? 0 : avfilter_get_by_name(filter_name); //AVFilterContext *ctx = filter->ctx; - int nb_pads = filter->nb_inputs; + int nb_pads = avfilter_filter_pad_count(filter,0); if( !filter || (nb_pads>1 && avfilter_pad_get_type(filter->inputs,0)) != AVMEDIA_TYPE_VIDEO ) { ff_err(AVERROR(EINVAL), "FFVideoStream::create_filter: %s\n", filter_spec); return -1; @@ -3920,7 +3955,7 @@ int FFVideoStream::create_filter(const char *filter_spec) AVPixelFormat pix_fmt = (AVPixelFormat)avpar->format; snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", - avpar->width, avpar->height, (int)pix_fmt, + avpar->width, avpar->height,(int)pix_fmt, st->time_base.num, st->time_base.den, sa_num, sa_den); if( ret >= 0 ) { filt_ctx = 0; @@ -3935,11 +3970,19 @@ int FFVideoStream::create_filter(const char *filter_spec) ret = insert_filter("buffersink", 0, "out"); buffersink_ctx = filt_ctx; } + /* + if( ret >= 0 ) { + ret = av_opt_set(buffersink_ctx, "pixel_formats", av_get_pix_fmt_name(pix_fmt), + AV_OPT_SEARCH_CHILDREN); + } + if( ret >= 0 ) { ret = av_opt_set_bin(buffersink_ctx, "pix_fmts", (uint8_t*)&pix_fmt, sizeof(pix_fmt), AV_OPT_SEARCH_CHILDREN); } + */ + if( ret >= 0 ) ret = config_filters(filter_spec, fsrc); else @@ -3959,7 +4002,7 @@ int FFAudioStream::create_filter(const char *filter_spec) while( --i>=0 && *sp!=0 && !strchr(" \t:=,",*sp) ) *np++ = *sp++; *np = 0; const AVFilter *filter = !filter_name[0] ? 0 : avfilter_get_by_name(filter_name); - int nb_pads = filter->nb_inputs; + int nb_pads = avfilter_filter_pad_count(filter,0); if( !filter || (nb_pads >1 && avfilter_pad_get_type(filter->inputs,0)) != AVMEDIA_TYPE_AUDIO ) { ff_err(AVERROR(EINVAL), "FFAudioStream::create_filter: %s\n", filter_spec); return -1; diff --git a/cinelerra-5.1/cinelerra/fileac3.C b/cinelerra-5.1/cinelerra/fileac3.C index 63654f32..34469aef 100644 --- a/cinelerra-5.1/cinelerra/fileac3.C +++ b/cinelerra-5.1/cinelerra/fileac3.C @@ -191,7 +191,9 @@ int FileAC3::close_file() if(codec_context) { encode_flush(); +#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(59,16,100) avcodec_close(codec_context); +#endif avcodec_free_context(&codec_context); codec = 0; } diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index f5134a78..ea2de8f2 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -227,7 +227,6 @@ PKG_3RD([ffmpeg],[yes], [ffmpeg-7.0], [ libavutil/libavutil.a \ libavcodec/libavcodec.a \ - libpostproc/libpostproc.a \ libavformat/libavformat.a \ libswscale/libswscale.a \ libavfilter/libavfilter.a \ -- 2.46.3
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".