View Issue Details

IDProjectCategoryView StatusLast Update
0000214Cinelerra-GG[All Projects] Featurepublic2019-09-06 14:14
ReporterAndrew-R Assigned Togoodguy  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version2019-08 
Summary0000214: Please look into adding dav1d AV1 decoder - faster than libAOM
DescriptionHello.

I try to record my 'feature' ideas here so they will be preserved.
In upcoming ffmpeg 4.2 (not yet branched) you can see support for faster AV1 decoder - dav1d

https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/9bf9358b615dbf3d0f81ca2dbfbec6103dc77f25

dav1d 0.3.0 was released in May: https://lwn.net/Articles/787422/
Code repo: https://code.videolan.org/videolan/dav1d

Unfortunately, for me it was not working (or may be ffmpeg was still defaulting to libaom even for decoding?):
https://lists.cinelerra-gg.org/pipermail/cin/2019-May/000648.html
Steps To Reproduceuse -ldav1d for ffmpeg-git configure (hack in thirdparty/Makefile), and add it (as hack) to system_libs += -ldav1d in global_config (after configure was run - proper integration probably will require code similar to https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blobdiff;f=cinelerra-5.1/configure.ac;h=90048a290fa23a145c91eb07be2dfb6cf1988edf;hp=408ed8e73c702c6cb5d078dd701c436030f612be;hb=0e82b3d8a226c7ed906d539db6418c472d542c75;hpb=307d7f624510fcca7a7f6c1e683796cb73637106 )
TagsNo tags attached.

Activities

PhyllisSmith

PhyllisSmith

2019-09-06 14:14

manager   ~0002080

Sufficiently implemented for now.
Andrew-R

Andrew-R

2019-09-06 02:33

reporter   ~0002078

Yes, I see ... if build works for both 32 and 64-bit distros at your and other users end ... feel free to close this!
PhyllisSmith

PhyllisSmith

2019-09-06 01:35

manager   ~0002076

Andrew, your makefile 32-bit patch was checked in (slightly modified) and it works well. We also tested on a Slackware 32-bit system. Thanks for all of this. I will be closing this issue in the next couple of days, if you agree. Also, hoping that they eventually create a faster encode to include with ffmpeg.
Andrew-R

Andrew-R

2019-09-05 23:58

reporter   ~0002075

For me things worked with forced (for ffmpeg) linkage to system-wide libdav1d, but I think I also made internal libdav1d compile on my 32-bit (Slackware userspace) machine.

original and modified by me Makefiles attached (they patched in during thirdparty configure/build phase, so git diff shows empty output on Makefile alone. But patching patch probably will work :} )

Makefile (8,869 bytes)
export TOPDIR ?= $(CURDIR)/../..
include $(TOPDIR)/global_config

_ARCH := $(shell uname -m)
export _ARCH

ifeq ($(_ARCH), i686)
ASMARCH := elf32
endif

ifeq ($(_ARCH), x86_64)
ASMARCH := elf64
endif



BUILD=build
DESTDIR=/
PREFIX=usr/local
LIBDIR=$(PREFIX)/lib
INCDIR=$(PREFIX)/include
# make Q="" for verbose
Q?=@echo == $@; 
OBJDIR?=$(BUILD)/static
NASM_BLD=$(OBJDIR)/nasm
ENTRY_BLD=$(OBJDIR)/entry
SRC_BLD=$(OBJDIR)/src
BIT8_BLD=$(OBJDIR)/bits8
BIT16_BLD=$(OBJDIR)/bits16
TOOLS_BLD=$(BUILD)/tools
TESTS_BLD=$(BUILD)/tests

STATIC_LIB=$(BUILD)/src/libdav1d.a
SHARED_LIB=$(BUILD)/src/libdav1d.so
DEFS= -DNDEBUG -D_FILE_OFFSET_BITS=64 -D_POSIX_C_SOURCE=200112L
FUZZ= -DDAV1D_MT_FUZZING

BLD_INCL= $(DEFS) -I. -Isrc -Iinclude/dav1d -Iinclude \
	-I$(BUILD) -I$(BUILD)/include -I$(BUILD)/include/dav1d
TOOLS_INCL= $(DEFS) -Itools -I. -I$(BUILD) -I$(BUILD)/tools \
	-Iinclude -Iinclude/dav1d -I$(BUILD)/include/dav1d \
	-I$(BUILD)/include -I/usr/include/SDL2

NP?=.NOTPARALLEL:
$(NP)
MAKE_P:=$(MAKE) -j NP=""

all: meson_data
	$(MAKE_P) $(STATIC_LIB) OBJDIR=$(BUILD)/static
	$(MAKE_P) $(SHARED_LIB) OBJDIR=$(BUILD)/shared
# req SDL
#	$(MAKE_P) $(TOOLS) OBJDIR=$(BUILD)/static
#	$(MAKE_P) $(TESTS) OBJDIR=$(BUILD)/static

CC_DEFS=\
	-DNDEBUG \
	-D_FILE_OFFSET_BITS=64 \
	-D_POSIX_C_SOURCE=200112L \

CC_OPTS=\
	-pipe \
	-Wall \
	-Winvalid-pch \
	-Wextra \
	-std=c99 \
	-O3 \
	-fvisibility=hidden \
	-Wundef \
	-Werror=vla \
	-Wno-maybe-uninitialized \
	-Wno-missing-field-initializers \
	-Wno-unused-parameter \
	-Werror=missing-prototypes \
	-fomit-frame-pointer \
	-ffast-math \
	-fPIC \
	-mpreferred-stack-boundary=5 \
	-MD -MQ $@ -MF [email protected] \

SHA_OPTS=\
	-Wl,--no-undefined \
	-Wl,--as-needed \
	-Wl,-O1 \
	-shared \
	-fPIC \
	-Wl,--start-group \
	-Wl,-soname,libdav1d.so.2 \
	-Wl,--end-group \
	-pthread \

CC_CC=$(Q)cc $(CC_OPTS) $(CFLAGS)
NASM=$(Q)/usr/bin/nasm
any=$(foreach i,$(2),$(1)/$(i))

# nasm
NASM_OBJS=$(call any,$(NASM_BLD), \
	cdef.obj \
	cdef_sse.obj \
	cpuid.obj \
	ipred.obj \
	ipred_ssse3.obj \
	itx.obj \
	itx_ssse3.obj \
	loopfilter.obj \
	looprestoration.obj \
	looprestoration_ssse3.obj \
	mc.obj \
	mc_ssse3.obj \
	msac.obj)
$(NASM_BLD)/%.obj: src/x86/%.asm
	$(NASM) -f $(ASMARCH) \
		-I src/ -I $(BUILD)/ -MQ $@ -MF [email protected] \
		$< -o $@

# entry
ENTRY_OBJS=$(call any,$(ENTRY_BLD), \
	lib.c.o \
	thread_task.c.o)
$(ENTRY_BLD)/%.c.o: src/%.c
	$(CC_CC) -Iinclude -Ibuild/include/dav1d -Isrc/entry $(BLD_INCL) \
		-mincoming-stack-boundary=4 -o $@ -c $<

# src
SRC_OBJS=$(call any,$(SRC_BLD), \
	cdf.o \
	cpu.o \
	data.o \
	decode.o \
	dequant_tables.o \
	getbits.o \
	intra_edge.o \
	lf_mask.o \
	log.o \
	msac.o \
	obu.o \
	picture.o \
	qm.o \
	ref.o \
	ref_mvs.o \
	scan.o \
	tables.o \
	warpmv.o \
	wedge.o \
	x86/cpu.c.o)
$(SRC_BLD)/%.o: src/%.c
	$(CC_CC) $(BLD_INCL) -pthread -o $@ -c $<
$(SRC_BLD)/x86/%.c.o: src/x86/%.c
	$(CC_CC) $(BLD_INCL) -o $@ -c $<

# bits
BITS_OBJS= \
	cdef_tmpl.o \
	cdef_apply_tmpl.o \
	film_grain_tmpl.o \
	ipred_tmpl.o \
	ipred_prepare_tmpl.o \
	itx_tmpl.o \
	lf_apply_tmpl.o \
	loopfilter_tmpl.o \
	looprestoration_tmpl.o \
	lr_apply_tmpl.o \
	mc_tmpl.o \
	recon_tmpl.o \
	x86/cdef_init_tmpl.c.o \
	x86/ipred_init_tmpl.c.o \
	x86/itx_init_tmpl.c.o \
	x86/loopfilter_init_tmpl.c.o \
	x86/looprestoration_init_tmpl.c.o \
	x86/mc_init_tmpl.c.o \

BIT8_OBJS=$(call any,$(BIT8_BLD),$(BITS_OBJS))
$(BIT8_BLD)/x86/%.c.o: src/x86/%.c
	$(CC_CC) $(BLD_INCL) -DBITDEPTH=8 -o $@ -c $<
$(BIT8_BLD)/%.o: src/%.c
	$(CC_CC) $(BLD_INCL) -DBITDEPTH=8 -o $@ -c $<

BIT16_OBJS=$(call any,$(BIT16_BLD),$(BITS_OBJS))
$(BIT16_BLD)/x86/%.c.o: src/x86/%.c
	$(CC_CC) $(BLD_INCL) -DBITDEPTH=16 -o $@ -c $<
$(BIT16_BLD)/%.o: src/%.c
	$(CC_CC) $(BLD_INCL) -DBITDEPTH=16 -o $@ -c $<

$(BUILD)/config.h:
	echo  > $@ "#pragma once"
	echo >> $@ "#define ARCH_AARCH64 0"
	echo >> $@ "#define ARCH_ARM 0"
	echo >> $@ "#define ARCH_PPC64LE 0"
	echo >> $@ "#define ARCH_X86 1"
ifeq ($(_ARCH), x86_64)
	echo >> $@ "#define ARCH_X86_32 0"
	echo >> $@ "#define ARCH_X86_64 1"
endif
ifeq ($(_ARCH), i686)
	echo >> $@ "#define ARCH_X86_32 1"
	echo >> $@ "#define ARCH_X86_64 0"
endif
	echo >> $@ "#define CONFIG_16BPC 1"
	echo >> $@ "#define CONFIG_8BPC 1"
	echo >> $@ "#define CONFIG_LOG 1"
	echo >> $@ "#define ENDIANNESS_BIG 0"
	echo >> $@ "#define HAVE_ASM 1"
	echo >> $@ "#define HAVE_POSIX_MEMALIGN 1"
	echo >> $@ "#define HAVE_UNISTD_H 1"
	echo >> $@ "#define STACK_ALIGNMENT 32"

$(BUILD)/config.asm:
ifeq ($(_ARCH), x86_64)
	echo  > $@ "%define ARCH_X86_32 0"
	echo >> $@ "%define ARCH_X86_64 1"
	echo >> $@ "%define PIC 1"
	echo >> $@ "%define STACK_ALIGNMENT 32"
endif

ifeq ($(_ARCH), i686)
	echo  > $@ "%define ARCH_X86_32 1"
	echo >> $@ "%define ARCH_X86_64 0"
	echo >> $@ "%define PIC 1"
	echo >> $@ "%define STACK_ALIGNMENT 32"
endif


$(BUILD)/include/vcs_version.h:
	mkdir -p $(BUILD)/include
	echo  > $@ "#define DAV1D_VERSION \"0.4.0\""

$(BUILD)/include/dav1d/version.h:
	mkdir -p $(BUILD)/include/dav1d
	echo  > $@ "#ifndef DAV1D_VERSION_H"
	echo >> $@ "#define DAV1D_VERSION_H"
	echo >> $@ "#define DAV1D_API_VERSION_MAJOR 2"
	echo >> $@ "#define DAV1D_API_VERSION_MINOR 0"
	echo >> $@ "#define DAV1D_API_VERSION_PATCH 0"
	echo >> $@ "#endif /* DAV1D_VERSION_H */"

$(TOOLS_BLD)/cli_config.h:
	mkdir -p $(TOOLS_BLD)
	echo  > $@ "#pragma once"
	echo >> $@ "#define HAVE_CLOCK_GETTIME 1"

.PHONY: meson_data
meson_data:
	make meson_dirs OBJDIR=$(BUILD)/static
	make meson_dirs OBJDIR=$(BUILD)/shared
	ln -sf ./include/compat/gcc/stdatomic.h .

.PHONY: meson_dirs
meson_dirs: $(OBJDIR) \
	$(BUILD)/config.h $(BUILD)/config.asm \
	$(BUILD)/include/vcs_version.h \
	$(BUILD)/include/dav1d/version.h \
	$(TOOLS_BLD)/cli_config.h \

LIB_OBJS=$(ENTRY_OBJS) $(NASM_OBJS) $(SRC_OBJS) $(BIT8_OBJS) $(BIT16_OBJS)

$(STATIC_LIB): DIR?=static
$(STATIC_LIB): $(LIB_OBJS)
	rm -f $@
	gcc-ar csrD $@ $(LIB_OBJS)

$(SHARED_LIB): DIR?=shared
$(SHARED_LIB): $(LIB_OBJS)
	rm -f $@
	cc -o $@ $(LIB_OBJS) $(SHA_OPTS)

# tools
DAV1D_OBJS=$(call any,$(TOOLS_BLD),\
	dav1d.o \
	dav1d_cli_parse.o \
	input/annexb.o \
	input/ivf.o \
	input/input.o \
	output/md5.o \
	output/null.o \
	output/output.o \
	output/y4m2.o \
	output/yuv.o)

DAV1DPLAY_OBJS=$(call any,$(TOOLS_BLD),\
	dav1dplay.o \
	input/annexb.o \
	input/ivf.o \
	input/input.o)

$(TOOLS_BLD)/%.o: tools/%.c
	$(CC_CC) $(TOOLS_INCL) -o $@ -c $<

DAV1D=$(TOOLS_BLD)/dav1d
$(DAV1D): $(DAV1D_OBJS)
	$(CC_CC) -pthread -I$(BUILD) -o $@ $(DAV1D_OBJS) $(STATIC_LIB)

DAV1DPLAY=$(TOOLS_BLD)/dav1dplay
$(DAV1DPLAY): $(DAV1DPLAY_OBJS)
	$(CC_CC) -pthread -o $(TOOLS_BLD)/dav1dplay $(DAV1DPLAY_OBJS) $(STATIC_LIB) -lSDL2

TOOLS=$(DAV1D) $(DAV1DPLAY)
.PHONY:	tools
tools:	$(TOOLS)

# tests
TESTS_CHKASM=tests/checkasm
TESTS_CHKASM_BLD=$(TESTS_BLD)/checkasm
CHKASM_BIT8=$(TESTS_CHKASM_BLD)/bit8
CHKASM_BIT16=$(TESTS_CHKASM_BLD)/bit16
CHKASM_BITS= \
	cdef.o \
	ipred.o \
	itx.o \
	loopfilter.o \
	looprestoration.o \
	mc.o \

CHKASM_BIT8_OBJS=$(call any,$(CHKASM_BIT8),$(CHKASM_BITS))
CHKASM_BIT16_OBJS=$(call any,$(CHKASM_BIT16),$(CHKASM_BITS))

TESTS_CHKASM_OBJS= \
	$(TESTS_CHKASM_BLD)/checkasm.o \
	$(TESTS_CHKASM_BLD)/msac.o \
	$(CHKASM_BIT8_OBJS) $(CHKASM_BIT16_OBJS) \
	$(TESTS_CHKASM_BLD)/x86/checkasm.obj \

$(TESTS_CHKASM_BLD)/%.o: $(TESTS_CHKASM)/%.c
	$(CC_CC) $(BLD_INCL) -o $@ -c $<
$(CHKASM_BIT8)/%.o: $(TESTS_CHKASM)/%.c
	$(CC_CC) $(BLD_INCL) -DBITDEPTH=8 -o $@ -c $<
$(CHKASM_BIT16)/%.o: $(TESTS_CHKASM)/%.c
	$(CC_CC) $(BLD_INCL) -DBITDEPTH=16 -o $@ -c $<
$(TESTS_CHKASM_BLD)/x86/%.obj: $(TESTS_CHKASM)/x86/%.asm
	@$(NASM) -f $(ASMARCH) \
		-I src/ -I $(BUILD)/ -MQ $@ -MF [email protected] \
		$< -o $@

CHECKASM=$(TESTS_BLD)/checkasm/checkasm
$(CHECKASM): $(TESTS_CHKASM_OBJS) $(STATIC_LIB)
	$(CC_CC) -pthread -o $@ $(TESTS_CHKASM_OBJS) $(STATIC_LIB) -lm

TESTS_FUZZER=tests/libfuzzer
TESTS_FUZZER_BLD=$(TESTS_BLD)/libfuzzer
TESTS_FUZZER_OBJS= \
	$(TESTS_FUZZER_BLD)/main.o \
	$(TESTS_FUZZER_BLD)/dav1d_fuzzer.o \

$(TESTS_FUZZER_BLD)/%.o: $(TESTS_FUZZER)/%.c
	$(CC_CC) $(BLD_INCL) -o $@ -c $<

DAV1D_FUZZER=$(TESTS_BLD)/dav1d_fuzzer
$(DAV1D_FUZZER): $(TESTS_FUZZER_OBJS) $(STATIC_LIB)
	$(CC_CC) -pthread -o $@ $(TESTS_FUZZER_OBJS) $(STATIC_LIB)

TESTS=$(CHECKASM) $(DAV1D_FUZZER)
.PHONY:	tests
tests:	$(TESTS)

$(OBJDIR):
	mkdir -p $@/include/dav1d \
		$(BUILD)/src $(BUILD)/include \
		$(ENTRY_BLD) $(NASM_BLD) \
		$(SRC_BLD)/x86 $(BIT8_BLD)/x86 $(BIT16_BLD)/x86 \
		$(TOOLS_BLD) $(TOOLS_BLD)/input $(TOOLS_BLD)/output \
		$(TESTS_CHKASM_BLD)/bit8 $(TESTS_CHKASM_BLD)/bit16 \
		$(TESTS_CHKASM_BLD)/x86 $(TESTS_FUZZER_BLD) \

clean:
	rm -rf $(BUILD)

install:
	mkdir -p $(DESTDIR)$(LIBDIR)
	cp -a $(STATIC_LIB) $(DESTDIR)$(LIBDIR)
	cp -a $(SHARED_LIB) $(DESTDIR)$(LIBDIR)
	mkdir -p $(DESTDIR)$(INCDIR)
	cp -a include/dav1d $(DESTDIR)$(INCDIR)
	rm -f $(DESTDIR)$(INCDIR)/dav1d/meson.build
	rm -f $(DESTDIR)$(INCDIR)/dav1d/version.h.in
	cp -a $(BUILD)/include/dav1d/version.h $(DESTDIR)$(INCDIR)/version.h

Makefile (8,869 bytes)
Makefile.orig (8,325 bytes)
PhyllisSmith

PhyllisSmith

2019-08-27 16:21

manager   ~0002044

Andrea, thanks for your hard work. GG booted Arch and says the final problem you had is due to the different method of Cuda implementation on Arch. He is scratching his head to look for a solution because the usual method is not available to Meson. Will let you know.
Andrea_Paz

Andrea_Paz

2019-08-27 12:32

manager  

cin5.tar.gz (79,081 bytes)
Andrea_Paz

Andrea_Paz

2019-08-27 12:32

manager   ~0002042

Sorry; I spoke too soon, I had not seen the new release.
- Without meson the compilation fails very soon. Attach the cin5_whitout_meson.log
- After installing meson and restarting the PC, the compilation fails, but, compared to first, at a much more advanced stage. Attached is the cin5_meson.log
Any tests I can run?
Andrea_Paz

Andrea_Paz

2019-08-27 11:44

manager   ~0002041

I don't know Meson, is that it?

[paz@archpaz ~]$ pacman -Ss meson
extra/meson 0.51.2-1
    High productivity build system
    
If this is the case, it is not installed on my system, but the compilation of the latest release of CinGG (2019-08-26) has not given errors. Tell me if I have to install meson and then repeat the compilation of CinGG.
PhyllisSmith

PhyllisSmith

2019-08-27 04:12

manager   ~0002038

Now that FFmpeg 4.2 has dav1d included, the patch to use it has been checked in based on Andrew's information.
Adding a "remap" option to {cinpath}/ffmpeg/decode.opts forces use of dav1d for the decode which appears to run at full speed, at least on our computers with 25 FPS examples (using the elecard website AV1 samples).

If for some weird reason you want to use the slooooooow libaom version to decode instead, you will have to modify the decode.opts file to comment out the last line.

There are no plans to incorporate a faster encode at this time for 2 reasons - encoding is always slow anyway and you can do that in a batch job AND will wait for FFmpeg to incorporate something faster than libaom (that way it is tested better, if they ever do).

ANDREA and others: "meson" is a new build requirement that may already exist but if you could let us know that an Arch build works, it would be much appreciated. That will save us from having the end of the month builds fail for any of the Linux distros if we know ahead of time.
Andrew-R

Andrew-R

2019-06-22 02:32

reporter   ~0001754

1) dav1d is ONLY decode, so you still need libaom for encode still and it runs at best 1.5fps
yeah ....

2) another requirement becomes necessary to add to cin if use dav1d -- that is meson (yet another build tool)
I think you can rely on already-build dav1d , checking it from configure .....

3) and now there is a "speedy" AV1 ENCODER in the form of SVT-AV1 0.5.0
yeah ...
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-May/243593.html
[PATCH v11 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

+ there is more!
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-May/244734.html
[FFmpeg-devel] [PATCH] avcodec: Add librav1e encoder
This one requires Rust! so not tested by me yet, because I'm not ready for this new adventure ...

and discussions extended into this June already ....
So, yeah, still waiting for ffmpeg 4.2 cut ... Thanks for working on all those 'wish' tickets, Phyllis! [and on documentation/communication aspect of this project, too!]
PhyllisSmith

PhyllisSmith

2019-06-21 23:12

manager   ~0001752

OK, so today gg actually test built dav1d with cinelerra. Although, yes, the DECODE has good fps (about 13fps before is now 25 fps, which matches the frame rate for an av1 test video file), there are still too many "gotcha-s" to add this at this time. He will address it again when a stable release of ffmpeg becomes available -- hopefully 4.2 real soon as 4.2-dev was being worked last November. Here are the issues that need to be resolved before adding dav1d to cinelerra.

1) dav1d is ONLY decode, so you still need libaom for encode still and it runs at best 1.5fps
2) another requirement becomes necessary to add to cin if use dav1d -- that is meson (yet another build tool)
3) and now there is a "speedy" AV1 ENCODER in the form of SVT-AV1 0.5.0

Where does this end? why don't the developers work on speeding up the libaom AV1 directly instead of creating new forks? will dav1d become the standard? will dav1d work on speeding up encode too? Will AV1 format really become a standard for videos or not?

I am hoping by waiting until a stable ffmpeg is available with dav1d in it, there will be more direction of where this is really going. For now, we wait to make sure this is a long lasting AV1 decoder so we can make it permanent. If someone has a definitive need for this sooner, we can discuss that.
PhyllisSmith

PhyllisSmith

2019-05-30 03:15

manager   ~0001618

Thanks for the patch -- this is high on gg's list but will not make it into May 31 build unfortunately.
Andrew-R

Andrew-R

2019-05-30 03:02

reporter   ~0001617

real patch

libdav1d_patch.diff (783 bytes)
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 3bb9dd8..bb7bc99 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -374,7 +374,13 @@ int FFStream::decode_activate()
 		}
 		while( ret >= 0 && st != 0 && !reading ) {
 			AVCodecID codec_id = st->codecpar->codec_id;
-			AVCodec *decoder = avcodec_find_decoder(codec_id);
+			/* hack */
+			const AVCodecDescriptor *descr = avcodec_descriptor_get(codec_id);
+			AVCodec *decoder = NULL;
+			decoder = avcodec_find_decoder(codec_id);
+			if ( descr->id == AV_CODEC_ID_AV1) {
+			 decoder = avcodec_find_decoder_by_name("libdav1d");
+		        }
 			avctx = avcodec_alloc_context3(decoder);
 			if( !avctx ) {
 				eprintf(_("cant allocate codec context\n"));
libdav1d_patch.diff (783 bytes)
Andrew-R

Andrew-R

2019-05-15 20:15

reporter   ~0001544

this one even work on both webm (av1) and mp4 (h264) files!

--------------hack!---------
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 3bb9dd8..e87cfa5 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -374,7 +374,18 @@ int FFStream::decode_activate()
                }
                while( ret >= 0 && st != 0 && !reading ) {
                        AVCodecID codec_id = st->codecpar->codec_id;
- AVCodec *decoder = avcodec_find_decoder(codec_id);
+ /* hack */
+ // AVCodec *decoder = avcodec_find_decoder(codec_id);
+
+ // const char* lib_aom_name = "libaom-av1";
+ const AVCodecDescriptor *descr = avcodec_descriptor_get(codec_id);
+ AVCodec *decoder = NULL;
+ decoder = avcodec_find_decoder(codec_id);
+ if ( descr->id == AV_CODEC_ID_AV1) {
+ decoder = avcodec_find_decoder_by_name("libdav1d");
+ }
+
+
                        avctx = avcodec_alloc_context3(decoder);
                        if( !avctx ) {
                                eprintf(_("cant allocate codec context\n"));
@@ -1543,6 +1554,7 @@ FFMPEG::FFMPEG(FileBase *file_base)
        has_audio = has_video = 0;
        opts = 0;
        opt_duration = -1;
+ opt_force_video_decoder = 0;
        opt_video_filter = 0;
        opt_audio_filter = 0;
        opt_hw_dev = 0;
@@ -2007,6 +2019,8 @@ int FFMPEG::read_options(FILE *fp, const char *options, AVDictionary *&opts)
                if( !ret ) {
                        if( !strcmp(key, "duration") )
                                opt_duration = strtod(val, 0);
+ else if( !strcmp(key, "force_video_decoder") )
+ opt_force_video_decoder = cstrdup(val);
                        else if( !strcmp(key, "video_filter") )
                                opt_video_filter = cstrdup(val);
                        else if( !strcmp(key, "audio_filter") )
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h
index b4867b8..e13504e 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.h
+++ b/cinelerra-5.1/cinelerra/ffmpeg.h
@@ -329,6 +329,7 @@ public:
        char *opt_video_filter;
        char *opt_audio_filter;
        char *opt_hw_dev;
+ char *opt_force_video_decoder;
        char file_format[BCTEXTLEN];
        int fflags;
-------------end-of-hack---------
Andrew-R

Andrew-R

2019-05-15 11:08

reporter   ~0001534

So, I simply hacked libdav1d as decoder for all streams ...now Cin was decoding this webm much faster!

------hack!-----
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 3bb9dd8..dc6914c 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -374,7 +374,9 @@ int FFStream::decode_activate()
                }
                while( ret >= 0 && st != 0 && !reading ) {
                        AVCodecID codec_id = st->codecpar->codec_id;
- AVCodec *decoder = avcodec_find_decoder(codec_id);
+ /* AVCodec *decoder = avcodec_find_decoder(codec_id);
+ hack */
+ AVCodec *decoder = avcodec_find_decoder_by_name("libdav1d");
                        avctx = avcodec_alloc_context3(decoder);
                        if( !avctx ) {
                                eprintf(_("cant allocate codec context\n"));
@@ -1543,6 +1545,7 @@ FFMPEG::FFMPEG(FileBase *file_base)
        has_audio = has_video = 0;
        opts = 0;
        opt_duration = -1;
+ opt_force_video_decoder = 0;
        opt_video_filter = 0;
        opt_audio_filter = 0;
        opt_hw_dev = 0;
@@ -2007,6 +2010,8 @@ int FFMPEG::read_options(FILE *fp, const char *options, AVDictionary *&opts)
                if( !ret ) {
                        if( !strcmp(key, "duration") )
                                opt_duration = strtod(val, 0);
+ else if( !strcmp(key, "force_video_decoder") )
+ opt_force_video_decoder = cstrdup(val);
                        else if( !strcmp(key, "video_filter") )
                                opt_video_filter = cstrdup(val);
                        else if( !strcmp(key, "audio_filter") )
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h
index b4867b8..e13504e 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.h
+++ b/cinelerra-5.1/cinelerra/ffmpeg.h
@@ -329,6 +329,7 @@ public:
        char *opt_video_filter;
        char *opt_audio_filter;
        char *opt_hw_dev;
+ char *opt_force_video_decoder;
        char file_format[BCTEXTLEN];
        int fflags;
--------------------------

./cin
Cinelerra Infinity - built: May 15 2019 07:53:40
git://git.cinelerra-gg.org/goodguy/cinelerra.git
(c) 2006-2018 Heroine Virtual Ltd. by Adam Williams
(c) 2007-2018 cin5 derivative by W.P. Morrow aka goodguy
Cinelerra is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. There is absolutely no warranty for Cinelerra.

init plugin index: /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/bin/plugins
PluginFFilter::new_ffilter(overlay_opencl)
  err: Ошибка ввода/вывода
PluginFFilter::new_ffilter(xmedian)
  err: Операция не позволена
[openclsrc_682 @ 0xd729a00] OpenCL source requires output dimensions to be specified.
PluginFFilter::new_ffilter(openclsrc)
  err: Недопустимый аргумент
init lv2 index:
[libaom-av1 @ 0xd6772c0] v1.0.0
[libaom-av1 @ 0xd6772c0] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[AVIOContext @ 0xd70bc40] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xd6772c0] v1.0.0
[libaom-av1 @ 0xd6772c0] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[libaom-av1 @ 0xd714b00] v1.0.0
[libaom-av1 @ 0xd714b00] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[AVIOContext @ 0xd69c340] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xe4708c40] v1.0.0
[libaom-av1 @ 0xe4708c40] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[libaom-av1 @ 0xe510e200] v1.0.0
[libaom-av1 @ 0xe510e200] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[AVIOContext @ 0xd724c40] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xe4709680] v1.0.0
[libaom-av1 @ 0xe4709680] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libdav1d @ 0xd9f30f40] libdav1d 0.3.0
[libaom-av1 @ 0xdb56c180] v1.0.0
[libaom-av1 @ 0xdb56c180] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libdav1d @ 0xe51f3d80] libdav1d 0.3.0
[AVIOContext @ 0xe51fee40] Statistics: 759514 bytes read, 0 seeks
[AVIOContext @ 0xe51099c0] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xedcc0540] v1.0.0
[libaom-av1 @ 0xedcc0540] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[libaom-av1 @ 0xd216c280] v1.0.0
[libaom-av1 @ 0xd216c280] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libdav1d @ 0xd0c31e00] libdav1d 0.3.0
[matroska,webm @ 0xedcc0e40] Element at 0x36687cb ending at 0x3668d02 exceeds containing master element ending at 0x36687c5
[AVIOContext @ 0xe4780b80] Statistics: 16326314 bytes read, 16 seeks
[AVIOContext @ 0xe47075c0] Statistics: 759514 bytes read, 0 seeks
[AVIOContext @ 0xd2167b80] Statistics: 61175797 bytes read, 13 seeks
[AVIOContext @ 0xedcbedc0] Statistics: 759514 bytes read, 0 seeks
Session time: 0:03:12
Cpu time: user: 0:03:45.552 sys: 0:00:19.488

Obviously it will not work for any other stream! :/ Sorry, not good at all with C/C++ ....
Andrew-R

Andrew-R

2019-05-15 10:34

reporter   ~0001533

Hm, it seems currently Cinelerra-GG has no way to force _video_decoder (out of ones available in ffmpeg for given id).

I tried to figure this part out ..so far added this part into cinelerra/ffmpegc/h:

diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 3bb9dd8..3da9f9c 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -2007,6 +2007,8 @@ int FFMPEG::read_options(FILE *fp, const char *options, AVDictionary *&opts)
                if( !ret ) {
                        if( !strcmp(key, "duration") )
                                opt_duration = strtod(val, 0);
+ else if( !strcmp(key, "force_video_decoder") )
+ opt_force_video_decoder = cstrdup(val);
                        else if( !strcmp(key, "video_filter") )
                                opt_video_filter = cstrdup(val);
                        else if( !strcmp(key, "audio_filter") )
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h
index b4867b8..e13504e 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.h
+++ b/cinelerra-5.1/cinelerra/ffmpeg.h
@@ -329,6 +329,7 @@ public:
        char *opt_video_filter;
        char *opt_audio_filter;
        char *opt_hw_dev;
+ char *opt_force_video_decoder;
        char file_format[BCTEXTLEN];
        int fflags;

---------------

Now I should reuse this new option somewhere around line 377:
https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=blob;f=cinelerra-5.1/cinelerra/ffmpeg.C;h=3bb9dd8018c9075810154bf112e3843e4677dcb9;hb=HEAD

in FFStream::decode_activate()

Apparently, there exist function avcodec_find_decoder_by_name:
https://www.ffmpeg.org/doxygen/4.1/group__lavc__decoding.html#ga776f2359007e8457799503068419e791
PhyllisSmith

PhyllisSmith

2019-05-15 04:02

manager   ~0001531

GG will spend the time to try this. libaom creates wonderful compression and the output looks fantastic but it plays like pond water or as you said: "More normal Cinelerra-GG with 4.1 ffmpeg and libaom-1.0 decodes them OK, but as slideshow".

I downloaded from the internet this file and with its stated frame rate of 25, I usually only got 16 fps:
     Stream2_AV1_4K_22.7mbps.webm
If you have time to compare with aom versus dav1d using Cinelerra, it would be quite convincing to try this here sooner. If we can see how much faster it is, we could kick aom out and put dav1d in instead. No one is going to use aom if it is this slow.
Andrew-R

Andrew-R

2019-05-14 18:59

reporter   ~0001527

Actually, just build ffmpeg (from thirdparty) CAN use libdav1d!

root@slax:/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/bin# ../thirdparty/ffmpeg.git/ffmpeg -benchmark -i /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm -map 0:v:0 -f null -
ffmpeg version N-93862-gf49cec2ba8 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 5.5.0 (GCC)
  configuration: --enable-pthreads --enable-gpl --disable-ffplay --enable-vaapi --enable-vdpau --enable-libtwolame --enable-libopenjpeg --enable-libmp3lame --enable-libaom --enable-libwebp --enable-libopus --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libx264 --enable-libx265 --extra-cflags=' -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/twolame-0.3.13/libtwolame -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libaom-v1.0.0/usr/local/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/openjpeg-2.3.0/src/lib/openjp2 -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libogg-1.3.3/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/opus-1.3/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvpx-1.8.0/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x264-snapshot-20190117-2245-stable/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/source -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/source ' --extra-cxxflags=-D__STDC_CONSTANT_MACROS --pkg-config=true --extra-libs='-Wl,--start-group -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/twolame-0.3.13/libtwolame/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/twolame-0.3.13/libtwolame/.libs/libtwolame.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/libmp3lame/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/libmp3lame/.libs/libmp3lame.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/mpglib/.libs/libmpgdecoder.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libaom-v1.0.0/usr/local/lib /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libaom-v1.0.0/usr/local/lib/libaom.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebp.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebpdecoder.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebpdemux.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebpmux.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/openjpeg-2.3.0/bin /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/openjpeg-2.3.0/bin/libopenjp2.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/opus-1.3/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/opus-1.3/.libs/libopus.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libogg-1.3.3/lib/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libogg-1.3.3/src/.libs/libogg.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs/libvorbis.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs/libvorbisenc.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs/libvorbisfile.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs/libtheora.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs/libtheoradec.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs/libtheoraenc.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvpx-1.8.0/ /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvpx-1.8.0/libvpx.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x264-snapshot-20190117-2245-stable/ /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x264-snapshot-20190117-2245-stable/libx264.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/ /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/libx265.a -Wl,--end-group -L/usr/X11R7/lib -lm -lstdc++ -pthread -lOpenCL -ldav1d -lva -lva-x11 -lva-drm -ldl' --enable-opencl --enable-libdav1d --extra-ldflags=' -lva -lva-x11 -lva-drm -ldl'
  libavutil 56. 27.100 / 56. 27.100
  libavcodec 58. 52.101 / 58. 52.101
  libavformat 58. 27.103 / 58. 27.103
  libavdevice 58. 7.100 / 58. 7.100
  libavfilter 7. 53.100 / 7. 53.100
  libswscale 5. 4.101 / 5. 4.101
  libswresample 3. 4.100 / 3. 4.100
  libpostproc 55. 4.100 / 55. 4.100
[libaom-av1 @ 0xbde3c40] v1.0.0
Input #0, matroska,webm, from '/mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm':
  Metadata:
    encoder : libwebm-0.2.1.0
  Duration: 00:02:24.12, start: 0.000000, bitrate: 3166 kb/s
    Stream #0:0(eng): Video: av1 (Main), yuv420p(tv), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
[libaom-av1 @ 0xbde4980] v1.0.0
Stream mapping:
  Stream #0:0 -> #0:0 (av1 (libaom-av1) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder : Lavf58.27.103
    Stream #0:0(eng): Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      encoder : Lavc58.52.101 wrapped_avframe
[matroska,webm @ 0xbde1c80] Element at 0x36687cb ending at 0x3668d02 exceeds containing master element ending at 0x36687c5
frame= 3604 fps= 18 q=-0.0 Lsize=N/A time=00:02:24.16 bitrate=N/A speed=0.73x
video:1394kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=418.219s stime=2.183s rtime=197.479s
bench: maxrss=99192kB

====================================
SPEED libaom-1.0 = 0.73 realtime

root@slax:/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/bin# ../thirdparty/ffmpeg.git/ffmpeg -benchmark -c:v libdav1d -i /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm -map 0:v:0 -f null -
ffmpeg version N-93862-gf49cec2ba8 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 5.5.0 (GCC)
  configuration: --enable-pthreads --enable-gpl --disable-ffplay --enable-vaapi --enable-vdpau --enable-libtwolame --enable-libopenjpeg --enable-libmp3lame --enable-libaom --enable-libwebp --enable-libopus --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libx264 --enable-libx265 --extra-cflags=' -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/twolame-0.3.13/libtwolame -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libaom-v1.0.0/usr/local/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/openjpeg-2.3.0/src/lib/openjp2 -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libogg-1.3.3/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/opus-1.3/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/include -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvpx-1.8.0/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x264-snapshot-20190117-2245-stable/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/source -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/. -I/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/source ' --extra-cxxflags=-D__STDC_CONSTANT_MACROS --pkg-config=true --extra-libs='-Wl,--start-group -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/twolame-0.3.13/libtwolame/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/twolame-0.3.13/libtwolame/.libs/libtwolame.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/libmp3lame/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/libmp3lame/.libs/libmp3lame.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/lame-3.100/mpglib/.libs/libmpgdecoder.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libaom-v1.0.0/usr/local/lib /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libaom-v1.0.0/usr/local/lib/libaom.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebp.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebpdecoder.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebpdemux.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libwebp-1.0.2/usr/local/lib/libwebpmux.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/openjpeg-2.3.0/bin /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/openjpeg-2.3.0/bin/libopenjp2.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/opus-1.3/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/opus-1.3/.libs/libopus.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libogg-1.3.3/lib/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libogg-1.3.3/src/.libs/libogg.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs/libvorbis.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs/libvorbisenc.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvorbis-1.3.6/lib/.libs/libvorbisfile.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs/libtheora.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs/libtheoradec.a /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libtheora-1.1.1/lib/.libs/libtheoraenc.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvpx-1.8.0/ /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/libvpx-1.8.0/libvpx.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x264-snapshot-20190117-2245-stable/ /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x264-snapshot-20190117-2245-stable/libx264.a -L/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/ /dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/thirdparty/../thirdparty/x265_3.0/libx265.a -Wl,--end-group -L/usr/X11R7/lib -lm -lstdc++ -pthread -lOpenCL -ldav1d -lva -lva-x11 -lva-drm -ldl' --enable-opencl --enable-libdav1d --extra-ldflags=' -lva -lva-x11 -lva-drm -ldl'
  libavutil 56. 27.100 / 56. 27.100
  libavcodec 58. 52.101 / 58. 52.101
  libavformat 58. 27.103 / 58. 27.103
  libavdevice 58. 7.100 / 58. 7.100
  libavfilter 7. 53.100 / 7. 53.100
  libswscale 5. 4.101 / 5. 4.101
  libswresample 3. 4.100 / 3. 4.100
  libpostproc 55. 4.100 / 55. 4.100
[libdav1d @ 0xb3d3000] libdav1d 0.3.0
Input #0, matroska,webm, from '/mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm':
  Metadata:
    encoder : libwebm-0.2.1.0
  Duration: 00:02:24.12, start: 0.000000, bitrate: 3166 kb/s
    Stream #0:0(eng): Video: av1 (Main), yuv420p(tv), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
[libdav1d @ 0xb3d3b00] libdav1d 0.3.0
Stream mapping:
  Stream #0:0 -> #0:0 (av1 (libdav1d) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder : Lavf58.27.103
    Stream #0:0(eng): Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      encoder : Lavc58.52.101 wrapped_avframe
[matroska,webm @ 0xb3d0c80] Element at 0x36687cb ending at 0x3668d02 exceeds containing master element ending at 0x36687c5
frame= 3604 fps= 66 q=-0.0 Lsize=N/A time=00:02:24.16 bitrate=N/A speed=2.65x
video:1394kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=87.672s stime=2.283s rtime=54.503s
bench: maxrss=107208kB
----------------

SPEED libdav1d 0.3.0 = 2.65 realtime

But i still have no idea how to convince Cinelerra-GG to use libdav1d :/
Andrew-R

Andrew-R

2019-05-14 18:41

reporter   ~0001526

yeah, Cinelerra-GG apparently use libaom-av1 for decoding, and quite generic version (today's compile - Cin-GG git + ffmpeg.git)

root@slax:/dev/shm/tmp/cinelerra-goodguy-20190514/cinelerra-5.1/bin# ./cin
Cinelerra Infinity - built: May 14 2019 20:53:37
git://git.cinelerra-gg.org/goodguy/cinelerra.git
(c) 2006-2018 Heroine Virtual Ltd. by Adam Williams
(c) 2007-2018 cin5 derivative by W.P. Morrow aka goodguy
Cinelerra is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. There is absolutely no warranty for Cinelerra.

[libaom-av1 @ 0xd8cd300] v1.0.0
[libaom-av1 @ 0xd8cd300] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[AVIOContext @ 0xd87be00] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xd8cd300] v1.0.0
[libaom-av1 @ 0xd8cd300] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[libaom-av1 @ 0xd85d1c0] v1.0.0
[libaom-av1 @ 0xd85d1c0] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[AVIOContext @ 0xd873a80] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xd8efd40] v1.0.0
[libaom-av1 @ 0xd8efd40] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[libaom-av1 @ 0xe2e07040] v1.0.0
[libaom-av1 @ 0xe2e07040] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[AVIOContext @ 0xd97c640] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xd974480] v1.0.0
[libaom-av1 @ 0xd974480] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libaom-av1 @ 0xd845a00] v1.0.0
[libaom-av1 @ 0xd845a00] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libaom-av1 @ 0xe2e079c0] v1.0.0
[libaom-av1 @ 0xe2e079c0] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libaom-av1 @ 0xe2e60dc0] v1.0.0
[libaom-av1 @ 0xe2e60dc0] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[AVIOContext @ 0xe2e843c0] Statistics: 2840690 bytes read, 4 seeks
[AVIOContext @ 0xe2e058c0] Statistics: 759514 bytes read, 0 seeks
[libaom-av1 @ 0xec206e40] v1.0.0
[libaom-av1 @ 0xec206e40] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
FFMPEG::open_decoder: some stream times estimated: /mnt/sdb1/Stream2_AV1_720p_3.2mbps.webm
[libaom-av1 @ 0xec2605c0] v1.0.0
[libaom-av1 @ 0xec2605c0] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic
[libaom-av1 @ 0xec260940] v1.0.0
[libaom-av1 @ 0xec260940] cmake aom-master -G "Unix Makefiles" -DAOM_TARGET_CPU=generic

after adding .opts file with this content:
video_codec=libdav1d
loglevel=verbose

at the same directory where media file is.

So, i still don't know how to force specific codec :/

Yet, reading Features5.pdf gave me idea about adding special environment variables instead of hacking makefiles!

export EXTRA_LIBS=" -lOpenCL -ldav1d"
export FFMPEG_EXTRA_CFG=" --enable-opencl --enable-libdav1d"
setarch i686 ./configure --with-git-ffmpeg=https://git.ffmpeg.org/ffmpeg.git --with-single-user

and after make and make install I have my new Cinelerra ...

Issue History

Date Modified Username Field Change
2019-05-14 04:24 Andrew-R New Issue
2019-05-14 18:41 Andrew-R Note Added: 0001526
2019-05-14 18:59 Andrew-R Note Added: 0001527
2019-05-15 04:02 PhyllisSmith Note Added: 0001531
2019-05-15 04:02 PhyllisSmith Assigned To => goodguy
2019-05-15 04:02 PhyllisSmith Status new => assigned
2019-05-15 10:34 Andrew-R Note Added: 0001533
2019-05-15 11:08 Andrew-R Note Added: 0001534
2019-05-15 20:15 Andrew-R Note Added: 0001544
2019-05-30 03:02 Andrew-R File Added: libdav1d_patch.diff
2019-05-30 03:02 Andrew-R Note Added: 0001617
2019-05-30 03:15 PhyllisSmith Note Added: 0001618
2019-06-21 23:12 PhyllisSmith Note Added: 0001752
2019-06-21 23:13 PhyllisSmith Status assigned => confirmed
2019-06-22 02:32 Andrew-R Note Added: 0001754
2019-08-27 04:12 PhyllisSmith Status confirmed => feedback
2019-08-27 04:12 PhyllisSmith Note Added: 0002038
2019-08-27 11:44 Andrea_Paz Note Added: 0002041
2019-08-27 12:32 Andrea_Paz Note Added: 0002042
2019-08-27 12:32 Andrea_Paz File Added: cin5.tar.gz
2019-08-27 16:21 PhyllisSmith Note Added: 0002044
2019-09-05 23:58 Andrew-R File Added: Makefile
2019-09-05 23:58 Andrew-R File Added: Makefile.orig
2019-09-05 23:58 Andrew-R Note Added: 0002075
2019-09-05 23:58 Andrew-R Status feedback => assigned
2019-09-06 01:35 PhyllisSmith Note Added: 0002076
2019-09-06 02:33 Andrew-R Note Added: 0002078
2019-09-06 14:14 PhyllisSmith Status assigned => closed
2019-09-06 14:14 PhyllisSmith Resolution open => fixed
2019-09-06 14:14 PhyllisSmith Fixed in Version => 2019-08
2019-09-06 14:14 PhyllisSmith Note Added: 0002080