Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid FPS with dshow usb camera #514

Open
LazyCuteLion opened this issue Oct 14, 2024 · 10 comments
Open

Invalid FPS with dshow usb camera #514

LazyCuteLion opened this issue Oct 14, 2024 · 10 comments

Comments

@LazyCuteLion
Copy link
Contributor

when play with camera, i choose the menu-item[MJPG,1920x1080,30FPS],but actually play with [YUY2,1920x1080,5FPS].

@LazyCuteLion
Copy link
Contributor Author

LazyCuteLion commented Oct 14, 2024

check the log,it seems to be ffmpeg?
Flyleaf Log:
16.30.18.214 | Debug | [#1] [Demuxer: Main] Opening -> Stopped
16.30.18.226 | Debug | [#1] [Decoder: Video] Stopped -> Opening
16.30.18.238 | Info | [#1] [Decoder: Video] VA AV_CODEC_ID_MJPEG not supported
16.30.18.246 | Info | [#1] [Demuxer: Main] [Video #0] Enabled
16.30.18.251 | Debug | [#1] [Decoder: Video] Opening -> Stopped
16.30.18.261 | Info | [#1] [DecoderContext] [OpenVideoStream] #_ => #0
16.30.18.282 | Info | [#1] [DecoderContext] [OpenPlaylistItem] None =>
16.30.18.288 | Info | [#1] [DecoderContext] [Open] fmt://dshow?video=USB Camera&video_size=1920x1080&framerate=30&vcodec=mjpeg
16.30.18.311 | Debug | [#1] [Player ] OnBufferingStarted
16.30.18.319 | Debug | [#1] [Demuxer: Main] Stopped -> Running
16.30.18.325 | Debug | [#1] [Decoder: Video] Stopped -> Running
16.30.18.340 | Debug | [#1] [Demuxer: Main] Thread started (Running)
16.30.18.349 | Debug | [#1] [Decoder: Video] Thread started (Running)
16.30.18.383 | Debug | [#1] [Renderer ] Preparing planes for yuvj422p with Flyleaf
16.30.18.410 | Debug | [#1] [Renderer ] Prepared planes for yuvj422p with Flyleaf [YUVPlanar]
16.30.18.730 | Info | [#1] [Player ] Started [V: 00:00:00.0333337]
16.30.18.735 | Debug | [#1] [Player ] OnBufferingCompleted

FFmpeg Log:
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=d8 avail_size_in_buf=280550
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 0 bytes (0 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=db avail_size_in_buf=280548
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] index=0
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] qscale[0]: 1
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 67 bytes (536 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=db avail_size_in_buf=280479
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] index=1
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] qscale[1]: 2
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 67 bytes (536 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=c0 avail_size_in_buf=280410
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] Changing bps from 0 to 8
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] sof0: picture: 1920x1080
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] component 0 2:1 id: 0 quant:0
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] component 1 1:1 id: 1 quant:1
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] component 2 1:1 id: 2 quant:1
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] pix fmt id 21111100
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] Format yuvj422p chosen by get_format().
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 17 bytes (136 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=c4 avail_size_in_buf=280391
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 0 bytes (0 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=c4 avail_size_in_buf=280358
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 0 bytes (0 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=c4 avail_size_in_buf=280175
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 0 bytes (0 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=c4 avail_size_in_buf=280142
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 0 bytes (0 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=dd avail_size_in_buf=279959
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 0 bytes (0 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] escaping removed 590 bytes
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=da avail_size_in_buf=279953
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker parser used 279363 bytes (2234904 bits)
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] marker=d9 avail_size_in_buf=0
FFmpeg|Debug |[mjpeg @ 0000021f04955e40] decode frame unused 0 bytes
FFmpeg|Debug |[dshow @ 0000021f049513c0] All info found

@SuRGeoNix
Copy link
Owner

Hi @LazyCuteLion, flyleaf sets the proper ffmpeg parameters so I guess is an issue with FFmpeg? Can you try ffmpeg itself?

@LazyCuteLion
Copy link
Contributor Author

ffmpeg can not play , i tested by ffplay,it is ok.
en,i think it is because of ffmpeg.

@LazyCuteLion
Copy link
Contributor Author

if use ffmpeg to record a video (command:ffmpeg -f dshow -video_size 1920x1080 -framerate 30 -vcodec mjpeg -i video="USB Camera" "D:\xxxx.mp4") it is ok.
so,what is wrong?

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Oct 19, 2024

There is no point to test the FFmpeg if you transcode it to mp4 for example. Did you say that ffplay works or not? Possible try mpv as well?

@LazyCuteLion
Copy link
Contributor Author

ffplay work, the command:-f dshow -video_size 1920x1080 -framerate 30 -vcodec mjpeg -i video="USB Camera"
mpv,i try it, only play "av://dshow:video=USB Camera", when i add the parameters it doesn't work.(av://dshow:video=USB Camera:width=1920:height=1080:fps=30,I'm not familiar with mpv,can you give me the right url?)

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Oct 21, 2024

I can't think how Flyleaf will change the framerate itself. So something is wrong with ffmpeg and framerate parameter in your case. Wondering if FFmpeg version 5/6 have both the same issue. I will need to test it with a camera and reproduce it myself but to be honest, nobody complained for such an issue so far. Might something specific with your case.

A trace log would help (both for flyleaf and ffmpeg)

@LazyCuteLion
Copy link
Contributor Author

LazyCuteLion commented Oct 22, 2024

check the log(disable HW):
10.07.47.437 | Info | [#1] [Player ] Opening fmt://dshow?video=USB Camera&video_size=1920x1080&framerate=30&vcodec=mjpeg
10.07.47.444 | Debug | [#1] [Player ] Initializing
10.07.47.469 | Debug | [#1] [Player ] Initialized
10.07.47.503 | Info | [#1] [PluginHandler ] [OpenDefault] Open Success
10.07.47.510 | Info | [#1] [PluginHandler ] SuggestItem #0 -
10.07.47.525 | Info | [#1] [PluginHandler ] [OpenDefault] Open Item (0) Success
10.07.47.553 | Debug | [#1] [Demuxer: Main] Stopped -> Opening
10.07.47.726 | Debug | [#1] [Demuxer: Main] Ignoring format option reconnect
10.07.47.730 | Debug | [#1] [Demuxer: Main] Ignoring format option reconnect_streamed
10.07.47.733 | Debug | [#1] [Demuxer: Main] Ignoring format option reconnect_delay_max
10.07.47.736 | Debug | [#1] [Demuxer: Main] Ignoring format option user_agent
10.07.47.740 | Debug | [#1] [Demuxer: Main] Ignoring format option http_persistent
10.07.47.744 | Debug | [#1] [Demuxer: Main] Ignoring format option rtsp_transport
10.07.47.747 | Debug | [#1] [Demuxer: Main] Ignoring format option vcodec
10.07.48.100 | Info | [#1] [Demuxer: Main] Format Context Info
[Format ] DirectShow capture/dshow | | 45.17:50:43.3893680/00:00:00 | 45.17:50:43.3893680/00:00:00
[Video #0] mjpeg yuvj422p 1920x1080 @ 30 | [Color: BT601] [BR: 0] | 45.17:50:43.3893684/-10675199.02:48:05.4775808 | 45.17:50:43.3893684/00:00:00

last line is same to ffmpeg itself ( Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/bt709/unknown), 1920x1080, 30 fps, 30 tbr, 10000k tbn).
maybe ,it is Flyeaf can not be handled correctly the pixel format of yuvj422p?
Anyway, it's not really important.
should we close this issues?

@LazyCuteLion
Copy link
Contributor Author

LazyCuteLion commented Oct 22, 2024

Besides, you don't seem to have noticed of [#498]?
I'd rather you answered there than here.

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Oct 22, 2024

I don't think this is an issue with Pixel Format. I think is an issue with timestamps, that's why I asked you for flyleaf's trace log.
It's an issue so let it be open and might review this in the future (will try to reproduce it).

@SuRGeoNix SuRGeoNix changed the title play with camera Invalid FPS with dshow usb camera Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants