Okay cool, I added the check for the PAL flag - this still works fine
for my test-videos.
I also looked at the old hack above with the codec_tag check - changed
in 2013 for ticket #2177 (patch by Michael Niedermayer). I removed that
more specific hack and the test-video attached to ticket #2177 also runs
into the new hack now ... and still works fine. It also has a "dsf = 0"
flag, though it is PAL.
So it was really a good idea to consolidate those hacks! Maybe the whole
generic matching logic should be refactored, to match against the pal
flag instead of the dsf flag? (The "buf_size" check may also be obsolete
then). But this will be another task ;-)
I attached the updated patch.
Regards
Mark
Am 16.03.21 um 23:12 schrieb Marton Balint:
Then at least check the 50/60 flag as well in the VAUX source pack,
e.g.:
pal = !!(frame[80 * 5 + 48 + 3] & 0x20);
And as far as I see, the more specific hack checking for codec_tag and
similar can be removed then, because your check covers that case as well.
>From 0a3665729ed441fcf73dc37fa1fde54267d974f9 Mon Sep 17 00:00:00 2001
From: Mark Plomer <not-implemen...@mark-plomer.de>
Date: Thu, 18 Mar 2021 13:19:16 +0100
Subject: [PATCH] avcodec/dv_profile: PAL DV files with dsf flag 0 - detect via
pal flag and buf_size
Some old DV AVI files have the DSF-Flag of frames set to 0, although it
is PAL (maybe rendered with an old Ulead Media Studio Pro) ... this causes
ffmpeg/VLC-player to produce/play corrupted video (other players/editors
like VirtualDub work fine).
Fixes ticket #8333 and replaces/extends hack for ticket #2177
---
libavcodec/dv_profile.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c
index 66505c886b..0fc227dd04 100644
--- a/libavcodec/dv_profile.c
+++ b/libavcodec/dv_profile.c
@@ -261,24 +261,22 @@ const AVDVProfile* ff_dv_frame_profile(AVCodecContext* codec, const AVDVProfile
const uint8_t *frame, unsigned buf_size)
{
#if CONFIG_DVPROFILE
- int i, dsf, stype;
+ int i, dsf, stype, pal;
if(buf_size < DV_PROFILE_BYTES)
return NULL;
dsf = (frame[3] & 0x80) >> 7;
stype = frame[80 * 5 + 48 + 3] & 0x1f;
+ pal = !!(frame[80 * 5 + 48 + 3] & 0x20);
/* 576i50 25Mbps 4:1:1 is a special case */
if ((dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) ||
(stype == 31 && codec && codec->codec_tag==AV_RL32("SL25") && codec->coded_width==720 && codec->coded_height==576))
return &dv_profiles[2];
- if( stype == 0
- && codec
- && (codec->codec_tag==AV_RL32("dvsd") || codec->codec_tag==AV_RL32("CDVC"))
- && codec->coded_width ==720
- && codec->coded_height==576)
+ /* hack for trac issues #8333 and #2177, PAL DV files with dsf flag 0 - detect via pal flag and buf_size */
+ if (dsf == 0 && pal == 1 && 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++)
--
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".