Opened 2 years ago

Closed 2 years ago

#9568 closed defect (fixed)

FFmpeg crashed when input dshow filter

Reported by: kgp700 Owned by:
Priority: critical Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by kgp700)

Precondition :

  1. Build ffmpeg x86(32bit) binary with this commit (https://github.com/FFmpeg/FFmpeg/commit/911ba8417e8881a7380842e69e11ca05fdc46575#diff-d1c8390949244131fb904eb8338dcc0c33fedaf006bac94bfc0b6448aa0b595c) or release/4.4 or master commit
  1. dshow input : OBS 27.1.3 + OBS Virtual Cam 2.0.5 plugin

How to reproduce:
1.Run with Precondition build ffmpeg

"F:\Infinity_Media_Encoder_Alpha52\Tools\ffmpeg32\ffmpeg.exe" -y  -rtbufsize 2100M -f dshow -i video="OBS-Camera":audio="OBS-Audio" -pix_fmt yuv420p -vcodec libx264 -preset fast  -profile:v high -g 60 -keyint_min 60 -b:v 6500k -threads 0  -x264-params ref=2:fullrange=off:colorprim=bt709:me=umh:ref=4:mixed-refs=1:deblock=1,1:8x8dct=1:bframes=5:merange=25:subme=8:psy-rd=0.3:trellis=1:direct=auto:chroma_me=1:weightp=2:no-dct-decimate=1:no-fast-pskip=1:rc_lookahead=50:qcomp=0.9:ipratio=1.41:aq-mode=3:aq-strength=0.6:b-adapt=1:b-pyramid=1:no-scenecut=1 -bufsize:v 6500k  -maxrate:v 6500k -minrate:v 6500k  -acodec aac -b:a 192k -ar 48000 -map_metadata -1 -map_chapters -1 -f flv  "rtmp://192.168.50.243:1936/livetest2/kgn"

Actual Result : FFmpeg crashed (last log is [dshow @ 069c6c80] Selecting pin Video on video)

Comment :

  1. only reproduce on x86 build, can't reproduce on x86_64 build
  2. no problem with this commit build (https://github.com/FFmpeg/FFmpeg/commit/56709ca8aaffed529b62b2afa4288325d64dae57)
  3. I guess this issue caused by this commit : https://github.com/FFmpeg/FFmpeg/commit/911ba8417e8881a7380842e69e11ca05fdc46575#diff-d1c8390949244131fb904eb8338dcc0c33fedaf006bac94bfc0b6448aa0b595c

Change History (10)

comment:1 by kgp700, 2 years ago

Description: modified (diff)

comment:2 by kgp700, 2 years ago

Description: modified (diff)
Summary: FFmpeg crashed with input dshow filterFFmpeg crashed when input dshow filter

comment:3 by Diederick Niehorster, 2 years ago

Could it be all the removed WINAPI in dshowcapture.h? Can you test?

in reply to:  3 comment:4 by kgp700, 2 years ago

Replying to Diederick Niehorster:

Could it be all the removed WINAPI in dshowcapture.h? Can you test?

How can I test?

comment:5 by Diederick Niehorster, 2 years ago

Are you able to build FFmpeg from source? Then add back in the WINAPI that was removed in that commit, but keep all the rest the same. Then see if your program stops crashing.

in reply to:  5 comment:6 by kgp700, 2 years ago

Replying to Diederick Niehorster:

Are you able to build FFmpeg from source? Then add back in the WINAPI that was removed in that commit, but keep all the rest the same. Then see if your program stops crashing.

You mean add back WINAPI to master git source?
If do that I think will be stop crashing but it's hard for me. because I'm not developer...
I think it will be not fix just revert commit only for dshow_capture.h
It may get compile error.
maybe it affect to all dshow related source codes...(dshow.c,dshow_enummediatypes.c,dshow_enumpins.c,dshow_filter.c,dshow_filter.c)
recently so many things updated on dshow related codes.
I think hard to back for just copy&paste some codes or diff or patch
it's hard to add back WINAPI to master git source for me...
I hope ffmpeg developer fix it.
and after "avdevice/dshow: implement get_device_list" (ec579b4e3609d958a4c7fcec2db85b37243f318f) commit, do not work with OBS-Camera dshow filter. I will add new ticket for this issue.
I'm building ffmpeg with "avdevice/dshow: set no-seek flags" (937de260eb293000d1bf043974ef56cf9a1ad4e0) commit. no problem for input OBS-Video and OBS-Audio filter with that commit

Last edited 2 years ago by kgp700 (previous) (diff)

comment:7 by Diederick Niehorster, 2 years ago

You're right, its not just the header. Could you try building: https://github.com/dcnieho/ffmpeg/tree/develop? My latest commit there puts back all the WINAPI. There are several other changes as well that are not in ffmpeg proper, and wouldn't mind to see if that works for you :) If they cause trouble, i'll backport my commit putting back WINAPI to ffmpeg master, just let me know.

I'll have a look into the OBS issue as well.

comment:8 by Diederick Niehorster, 2 years ago

Hmm, the OBS issue is interesting. That dshow source returns a default format that is outside the capabilities of any of the formats returned by IAMStreamConfig_GetStreamCaps. That seems out of spec. But its a regression compared to previous operation of dshow, so I have fixed it, also in my tree: https://github.com/dcnieho/ffmpeg/tree/develop. Could you build that and test if it works for you too?

in reply to:  8 comment:9 by kgp700, 2 years ago

Replying to Diederick Niehorster:

Hmm, the OBS issue is interesting. That dshow source returns a default format that is outside the capabilities of any of the formats returned by IAMStreamConfig_GetStreamCaps. That seems out of spec. But its a regression compared to previous operation of dshow, so I have fixed it, also in my tree: https://github.com/dcnieho/ffmpeg/tree/develop. Could you build that and test if it works for you too?

Great thanks :)
obs-camera and 32bit ffmpeg both issues solved.
I hope apply to ffmpeg official git

Last edited 2 years ago by kgp700 (previous) (diff)

comment:10 by Diederick Niehorster, 2 years ago

Resolution: fixed
Status: newclosed

ITs been applied to master and the 5.0 release branch :)

Note: See TracTickets for help on using tickets.