From patchwork Sat Jan 16 13:40:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Plomer X-Patchwork-Id: 24977 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B53B8449A5A for ; Sat, 16 Jan 2021 15:40:10 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 93025680571; Sat, 16 Jan 2021 15:40:10 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.not-implemented.de (mail.not-implemented.de [94.130.183.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7207A68037A for ; Sat, 16 Jan 2021 15:40:04 +0200 (EET) Received: from [IPv6:2003:c5:872f:a200:3a59:ec1f:9055:a7b5] (p200300c5872fa2003a59ec1f9055a7b5.dip0.t-ipconnect.de [IPv6:2003:c5:872f:a200:3a59:ec1f:9055:a7b5]) by mail.not-implemented.de (Postfix) with ESMTPSA id 05E5F1F683 for ; Sat, 16 Jan 2021 14:40:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mark-plomer.de; s=dkim; t=1610804404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=epBnAksh9SxwryoNYmVb6aqBFDPC3W41uBF7u9pqxH4=; b=ZAFVukh/khR+MPXfb+y+la+vSUVuSwFYkVp8qdi+QHF4MlzGdySXWG6G2jM7RFGEThmxWk m/3cntY26+BD2ihHX9X/FkzYA+WjwAE658PGB811I9ral0UrUIb9KoVDajYeCA9Dw+hBJe v6oGj22aue7Sa3I1ML+JWQNPFSXcoBc= From: Mark Plomer To: ffmpeg-devel@ffmpeg.org Message-ID: <9017e9a3-8701-e787-7ec8-b576ed7accab@mark-plomer.de> Date: Sat, 16 Jan 2021 14:40:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: de-DE Subject: [FFmpeg-devel] [PATCH] avcodec/dv_profile: dv files with wrong dsf flag - detect via buf_size X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Trying to fix https://trac.ffmpeg.org/ticket/8333 Some of my old DV AVI files have the DSF-Flag of frames set to 0, although it is PAL (I think they were rendered with Ulead Media Studio Pro) ... this causes ffmpeg/VLC-player to produce/play corrupted video. In other players/editors it works fine including: - VirtualDub - Windows Media Player - AVCutty - Ulead Media Studio Pro (very old) I had a look at VirtualDub ... there the PAL/NTSC detection is based on the frame rate from AVISTREAMINFO header (dwRate/dwScale) - see https://github.com/Pavuucek/VirtualDub/blob/f47ebd2536f0034b048180d0b9cb9bde0ab10c73/src/VirtualDub/source/VideoSource.cpp#L1211 As I don't know, how to access the AVI header info inside dvvideo_decode_frame()/ff_dv_frame_profile(), I tried another workaround by checking the buf_size against the dv_profile. It works fine now, but I don't know, if this is really the best solution ... Subject: [PATCH] avcodec/dv_profile: dv files with wrong dsf flag - detect via buf_size --- libavcodec/dv_profile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c index 66505c886b..8f9a358032 100644 --- a/libavcodec/dv_profile.c +++ b/libavcodec/dv_profile.c @@ -281,6 +281,10 @@ const AVDVProfile* ff_dv_frame_profile(AVCodecContext* codec, const AVDVProfile && codec->coded_height==576) return &dv_profiles[1]; + /* hack for trac issue #8333, dv files with wrong dsf flag - detect via buf_size */ + if (dsf == 0 && stype == dv_profiles[1].video_stype && buf_size == dv_profiles[1].frame_size) + return &dv_profiles[1]; + for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype) return &dv_profiles[i];