[FFmpeg-devel] [PATCH] avcodec/dv_profile: dv files with wrong dsf flag - detect via buf_size

Mark Plomer not-implemented at mark-plomer.de
Tue Mar 16 22:51:19 EET 2021


Unfortunately it is not possible to move the hack to the bottom, because 
the "normal processing" (dv_profiles lookup loop) will catch it 
otherwise (with a wrong profile), because it does not check the frame_size:

     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];

But as the new "if" is very specific and catches an "invalid" 
combination only (with the frame_size check), it should not break 
anything, I think:

     if (dsf == 0 && stype == dv_profiles[1].video_stype && buf_size == 
dv_profiles[1].frame_size)

At least, I put the new hack after all other "pre-normal-processing" 
hacks ;-)

Regards
Mark

Am 13.03.21 um 17:48 schrieb Marton Balint:
>
>
> On Sat, 16 Jan 2021, Mark Plomer wrote:
>
>> 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 ...
>
> --- 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];
> +
>
> If possible, then it is probably better to move this fallback to later 
> in the code, right after the hack for trac issue #217, so previous 
> hacks won't get broken...
>
> Regards,
> Marton
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list