[FFmpeg-devel] [PATCH] avcodec/dv_profile: dv files with wrong dsf flag - detect via buf_size
Marton Balint
cus at passwd.hu
Sat Mar 13 18:48:37 EET 2021
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
More information about the ffmpeg-devel
mailing list