From 7b4a508c4609f77547dade6de3ddcff1681d6970 Mon Sep 17 00:00:00 2001 From: Mock Date: Thu, 2 Apr 2026 16:59:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BC=96=E8=AF=91=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E4=BD=BF=E8=AD=A6=E5=91=8A=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 4 ++++ cmd/v1_camera_pipeline_ifdef.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 39cf485..c2ea417 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ CPPFLAGS ?= -Iinclude -Ithird_party/cjson -Ithird_party/kcp LDFLAGS ?= -pthread PYTHON ?= python3 +ifeq ($(QUIET_FFMPEG_LOGS),1) +CFLAGS += -DQUIET_FFMPEG_LOGS +endif + BIN_DIR := bin SRC_DIR := src CMD_DIR := cmd diff --git a/cmd/v1_camera_pipeline_ifdef.c b/cmd/v1_camera_pipeline_ifdef.c index 0cd1ad7..a151dfc 100644 --- a/cmd/v1_camera_pipeline_ifdef.c +++ b/cmd/v1_camera_pipeline_ifdef.c @@ -268,7 +268,7 @@ AVCodecContext *create_mjpeg_decoder() AVCodecContext *ctx = avcodec_alloc_context3(decoder); ctx->width = WIDTH; ctx->height = HEIGHT; - ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // 使用YUVJ420P + ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // Use YUVJ420P for MJPEG compatibility. ctx->color_range = AVCOL_RANGE_JPEG; // JPEG范围 ctx->thread_count = 1; @@ -299,7 +299,7 @@ AVCodecContext *create_mjpeg_encoder() AVCodecContext *ctx = avcodec_alloc_context3(encoder); ctx->width = OUTPUT_WIDTH; ctx->height = OUTPUT_HEIGHT; - ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // 使用YUVJ420P + ctx->pix_fmt = AV_PIX_FMT_YUVJ420P; // Use YUVJ420P for MJPEG compatibility. ctx->time_base = (AVRational){1, 30}; ctx->qmin = 8; ctx->qmax = 31; @@ -432,6 +432,10 @@ int main() memset(&sender, 0, sizeof(sender)); +#ifdef QUIET_FFMPEG_LOGS + av_log_set_level(AV_LOG_ERROR); +#endif + PRINT_TIME("=== V4L2 Direct Capture + FFmpeg Processing ===\n"); // 1. Open V4L2 device