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