сб, 30 нояб. 2024 г., 01:07 Phyllis Smith via Cin <
[email protected]>:

> Andrew, should these and the QSV presets be checked into GIT now that
> Terje has tested them on his specific hardware?
>

yes, but 10bit ones require patch for themselves and recent one  removing
addition of ildct flag for some qsv encoders ....

"Exp: do not set ildct flag for qsv_av1/h264/vp9"
0001-yet-another-10bit-attempt.patch
0002-Hopefully-wire-up-various-cin_pix_fmt-for-vaapi-enco.patch

re-attached so you do not need to hunt them in mailthreads ....

I also have mediacodec/termux related profiles, and one hackfix for
mjpegtools failing to build here on clang.






> P.S. There will not be new Appimages created at the end of this month, but
> will wait until December.
>
>
> On Tue, Nov 26, 2024 at 3:52 PM Terje J. Hanssen <[email protected]>
> wrote:
>
>> Attached tested vaapi hwaccel presets as gzip'd tar file
>>
>> av1_vaapi_10b420.mp4
>> av1_vaapi_10b420.webm
>> av1_vaapi_8b420.mp4
>> av1_vaapi_8b420.webm
>> h264_vaapi_8b420.mp4
>> hevc_vaapi_10b420.mp4
>> hevc_vaapi_10b422.mp4
>> hevc_vaapi_8b420.mp4
>> vp9_vaapi_10b420.mp4
>> vp9_vaapi_10b420.webm
>> vp9_vaapi_8b420.mp4
>> vp9_vaapi_8b420.webm
>>
>>
>> --
> Cin mailing list
> [email protected]
> https://lists.cinelerra-gg.org/mailman/listinfo/cin
>
From d96635f03305582306f706447c94c58551f4fe7b Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Thu, 14 Nov 2024 16:18:24 +0300
Subject: [PATCH] yet another 10bit attempt

---
 cinelerra-5.1/cinelerra/ffmpeg.C | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index 7521c0ba..a6ee6def 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -1197,6 +1197,7 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
 AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
 {
 	const char *drm_node_enc = getenv("CIN_DRM_ENC");
+	const char *tenbit_enc = getenv("CIN_10BIT_ENC");
 	AVBufferRef *hw_device_ctx = 0;
 	AVBufferRef *hw_frames_ref = 0;
 	AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE;
@@ -1230,6 +1231,8 @@ AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
 		AVHWFramesContext *frames_ctx = (AVHWFramesContext *)(hw_frames_ref->data);
 		frames_ctx->format = AV_PIX_FMT_VAAPI;
 		frames_ctx->sw_format = AV_PIX_FMT_NV12;
+		if(tenbit_enc)
+		frames_ctx->sw_format = av_get_pix_fmt(tenbit_enc);
 		frames_ctx->width = width;
 		frames_ctx->height = height;
 		frames_ctx->initial_pool_size = 0; // 200;
-- 
2.46.2

From 4bc2b5e74eaf8349c1832f929ce845e4a36ce5ba Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Fri, 15 Nov 2024 19:21:11 +0300
Subject: [PATCH 2/2] Hopefully wire up various cin_pix_fmt for vaapi encoder

---
 cinelerra-5.1/cinelerra/ffmpeg.C | 8 +++-----
 cinelerra-5.1/cinelerra/ffmpeg.h | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index a6ee6def..6fdcf384 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -1194,10 +1194,9 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
 	return ret;
 }
 
-AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
+AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev, const char *hw_sformat)
 {
 	const char *drm_node_enc = getenv("CIN_DRM_ENC");
-	const char *tenbit_enc = getenv("CIN_10BIT_ENC");
 	AVBufferRef *hw_device_ctx = 0;
 	AVBufferRef *hw_frames_ref = 0;
 	AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE;
@@ -1231,8 +1230,7 @@ AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
 		AVHWFramesContext *frames_ctx = (AVHWFramesContext *)(hw_frames_ref->data);
 		frames_ctx->format = AV_PIX_FMT_VAAPI;
 		frames_ctx->sw_format = AV_PIX_FMT_NV12;
-		if(tenbit_enc)
-		frames_ctx->sw_format = av_get_pix_fmt(tenbit_enc);
+		if (strcmp(hw_sformat, "vaapi")) frames_ctx->sw_format = av_get_pix_fmt(hw_sformat);
 		frames_ctx->width = width;
 		frames_ctx->height = height;
 		frames_ctx->initial_pool_size = 0; // 200;
@@ -3060,7 +3058,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
 			}
 			AVPixelFormat pix_fmt = av_get_pix_fmt(asset->ff_pixel_format);
 			if( opt_hw_dev != 0 ) {
-				AVHWDeviceType hw_type = vid->encode_hw_activate(opt_hw_dev);
+				AVHWDeviceType hw_type = vid->encode_hw_activate(opt_hw_dev, asset->ff_pixel_format);
 				switch( hw_type ) {
 				case AV_HWDEVICE_TYPE_VAAPI:
 					pix_fmt = AV_PIX_FMT_VAAPI;
diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h
index ed864b59..5253d9c7 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.h
+++ b/cinelerra-5.1/cinelerra/ffmpeg.h
@@ -278,7 +278,7 @@ public:
 #else
 	int decode_hw_format(AVCodec *decoder, AVHWDeviceType type);
 #endif
-	AVHWDeviceType encode_hw_activate(const char *hw_dev);
+	AVHWDeviceType encode_hw_activate(const char *hw_dev, const char *hw_sformat);
 	int encode_hw_write(FFrame *picture);
 	int encode_frame(AVFrame *frame);
 	int create_filter(const char *filter_spec);
-- 
2.46.2

From c9f3ceeb56875c7def02e8ecea3d2a1f9f605e8a Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Tue, 26 Nov 2024 16:32:14 +0300
Subject: [PATCH] Exp: do not set ildct flag for qsv_av1/h264/vp9

---
 cinelerra-5.1/cinelerra/ffmpeg.C | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index a857bc3a..d45eb07e 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -2905,6 +2905,16 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
 	FFStream *fst = 0;
 	AVStream *st = 0;
 	AVCodecContext *ctx = 0;
+	
+	/* some encoders dislike ildct flag in ffmpeg 7.0/7.1 */
+	int is_no_ildct;
+	if (!strcmp (codec_name, "av1_qsv") ||
+	!strcmp(codec_name, "h264_qsv") ||
+	!strcmp(codec_name, "vp9_qsv"))
+		is_no_ildct=1;
+	else
+		is_no_ildct=0;
+
 
 	const AVCodecDescriptor *codec_desc = 0;
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
@@ -3115,7 +3125,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
 			av_dict_set(&sopts, "field_order", "tt", 0); 
 			else
 			av_dict_set(&sopts, "field_order", "tb", 0); 
-			if (ctx->codec_id != AV_CODEC_ID_MJPEG) 
+			if (ctx->codec_id != AV_CODEC_ID_MJPEG && !is_no_ildct) 
 			av_dict_set(&sopts, "flags", "+ilme+ildct", 0);
 			break;
 			case ILACE_MODE_BOTTOM_FIRST: 
@@ -3123,7 +3133,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
 			av_dict_set(&sopts, "field_order", "bb", 0); 
 			else
 			av_dict_set(&sopts, "field_order", "bt", 0); 
-			if (ctx->codec_id != AV_CODEC_ID_MJPEG)
+			if (ctx->codec_id != AV_CODEC_ID_MJPEG && !is_no_ildct)
 			av_dict_set(&sopts, "flags", "+ilme+ildct", 0);
 			break;
 			case ILACE_MODE_NOTINTERLACED: av_dict_set(&sopts, "field_order", "progressive", 0); break;
-- 
2.47.0

From 4b3c415ee2048e9ab4afd3ce06ecabba708693ae Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Thu, 17 Oct 2024 01:41:25 +0300
Subject: [PATCH] y4mdenoise fails on clang 19.1.2 on termux, disable

---
 cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9 | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9

diff --git a/cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9 b/cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9
new file mode 100644
index 00000000..a22b38b8
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9
@@ -0,0 +1,10 @@
+--- ./Makefile.am.orig	2024-10-17 01:30:58.998525349 +0300
++++ ./Makefile.am	2024-10-17 01:31:14.046525338 +0300
+@@ -21,7 +21,6 @@
+ 	yuvdenoise \
+ 	yuvfilters \
+ 	yuvdeinterlace \
+-	y4mdenoise \
+ 	y4mscaler \
+ 	y4munsharp \
+         y4mutils
-- 
2.47.0

From 3e5ec1f84f6e58c8eee105faee59db0156f9951f Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <[email protected]>
Date: Wed, 25 Sep 2024 00:46:28 +0300
Subject: [PATCH] Add mediacodec-based encoder profiles  for termux

---
 cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4 | 3 +++
 cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4 | 3 +++
 cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg      | 9 +++++++++
 3 files changed, 15 insertions(+)
 create mode 100644 cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4
 create mode 100644 cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4
 create mode 100644 cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg

diff --git a/cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4 b/cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4
new file mode 100644
index 00000000..b0bce96b
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4
@@ -0,0 +1,3 @@
+mp4 h264_mediacodec
+cin_pix_fmt=yuv420p
+pix_fmt=yuv420p
\ No newline at end of file
diff --git a/cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4 b/cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4
new file mode 100644
index 00000000..4f3bac1c
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4
@@ -0,0 +1,3 @@
+mp4 hevc_mediacodec
+cin_pix_fmt=yuv420p
+pix_fmt=yuv420p
\ No newline at end of file
diff --git a/cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg b/cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg
new file mode 100644
index 00000000..581f068b
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg
@@ -0,0 +1,9 @@
+mpeg mpeg2video
+trellis=1
+mbd=rd
+cmp=satd
+subcmp=satd
+b=25000000
+g=15
+bf=2
+b_strategy=1
-- 
2.46.1

-- 
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to