mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.71k stars 2.93k forks source link

Special block devices not detected as unseekable #5391

Open matoro opened 6 years ago

matoro commented 6 years ago

Creating a new issue as per recommendation from @thebombzen here: https://github.com/mpv-player/mpv/issues/1701#issuecomment-357410194

mpv version and platform

mpv 0.27.0 on Linux 4.14.13-1-ARCH x86_64 GNU/Linux

Reproduction steps

$ mpv /dev/video0

Expected behavior

mpv will access and play webcam stream.

Actual behavior

mpv attempts to resume playback from last time command was run. This results in the file getting accessed, but no window appearing for x time, where x is the value stored in the resume file in .config/mpv/watch_later/. Behaves as expected if the --no-resume-playback option is passed on the command line or set in the config file.

Log file

https://spit.mixtape.moe/view/raw/02aafc27

Traneptora commented 6 years ago

Does the problem still exist if you use mpv tv:// --tv-device=/dev/video0 rather than playing the device file directly? (mpv needs to be compiled with --enable-tv and --enable-tv-v4l2)

matoro commented 6 years ago

@thebombzen

waf: error: no such option: --enable-tv-v412

tv features:
    --enable-tv         enable TV interface [disable]
    --disable-tv-v4l2   disable Video4Linux2 TV interface [autodetect]
    --disable-libv4l2   disable libv4l2 support [autodetect]
    --disable-audio-input
                        disable audio input support [autodetect]
    --enable-dvbin      enable DVB input module [disable]
kevmitch commented 6 years ago

l, not 1

matoro commented 6 years ago

@thebombzen that fixes it. Output:

$ mpv tv:// --tv-device=/dev/video0
[10023085]    cplayer: Playing: tv://
[10023962]         tv: Selected driver: v4l2
[10023972]         tv:  name: Video 4 Linux 2 input
[10024472]         tv: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
[10024485]         tv: Selected device: Integrated_Webcam_HD: Integrate
[10024498]         tv:  Capabilities:  video capture  read/write  streaming
[10024508]         tv:  supported norms:
[10024518]         tv:  inputs: 0 = Camera 1;
[10024522]         tv:  Current input: 0
[10024540]         tv:  Current format: YUYV
[10036241]         tv: tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
[10036266]         tv: ioctl enum norm failed: Inappropriate ioctl for device
[10036274]         tv: Error: Cannot set norm!
[10036280]         tv: Selected input hasn't got a tuner!
[10037062]         tv: ioctl set mute failed: Invalid argument
[10042402]    cplayer:  (+) Video --vid=1 (rawvideo 640x480 30.000fps)
[10410980]    cplayer: VO: [gpu] 640x480 yuv420p
[14589591] statusline: V: 00:00:04 / 00:00:04 (97%)
[----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------]
[14768596]    cplayer: Not seekable - not saving state.
libv4l2: error dequeuing buf: Invalid argument
[14809482]         tv: VIDIOC_DQBUF failed: Invalid argument
libv4l2: error dequeuing buf: Invalid argument
[14809497]         tv: VIDIOC_DQBUF failed: Invalid argument
libv4l2: error dequeuing buf: Invalid argument
[14809506]         tv: VIDIOC_DQBUF failed: Invalid argument
libv4l2: error dequeuing buf: Invalid argument
[14809516]         tv: VIDIOC_DQBUF failed: Invalid argument
libv4l2: error dequeuing buf: Invalid argument
[14809524]         tv: VIDIOC_DQBUF failed: Invalid argument
libv4l2: error dequeuing buf: Invalid argument
[14809534]         tv: VIDIOC_DQBUF failed: Invalid argument
[14809547]         tv: ioctl set mute failed: Invalid argument
[14810627]         tv: 130 frames successfully processed, 11 frames dropped.
[14810927]    cplayer: 
[14810960]    cplayer: 
[14810965]    cplayer: Exiting... (Quit)

Is it a problem that this is not automatically detected?

Traneptora commented 6 years ago

If you don't have TV support built in, mpv will defer the Video4Linux2 device reading to FFmpeg. FFmpeg should report the TV device stream as non-seekable. I have no idea if FFmpeg does report this and mpv ignores it, or if FFmpeg incorrectly reports it as seekable. That's something to look into.

matoro commented 6 years ago

OK. I can provide debug logs as necessary as well.