mpv fails to play /dev/video0 with USB videocapture device.
HW setup:
https://wiki.batc.tv/Fushicai_USBTV007
Camera connected to composite video input.
kernel:
user@debian:~$ uname -r
4.9.0-3-amd64
lsmod:
user@debian:~$ lsmod
Module Size Used by
cpufreq_powersave 16384 0
cpufreq_userspace 16384 0
cpufreq_conservative 16384 0
coretemp 16384 0
nouveau 1544192 2
usbtv 20480 1
kvm_intel 192512 0
videobuf2_vmalloc 16384 1 usbtv
kvm 589824 1 kvm_intel
videobuf2_memops 16384 1 videobuf2_vmalloc
videobuf2_v4l2 24576 1 usbtv
videobuf2_core 36864 2 usbtv,videobuf2_v4l2
videodev 176128 3 usbtv,videobuf2_core,videobuf2_v4l2
mxm_wmi 16384 1 nouveau
wmi 16384 2 mxm_wmi,nouveau
iTCO_wdt 16384 0
video 40960 1 nouveau
irqbypass 16384 1 kvm
iTCO_vendor_support 16384 1 iTCO_wdt
ttm 98304 1 nouveau
drm_kms_helper 155648 1 nouveau
drm 360448 5 nouveau,ttm,drm_kms_helper
media 40960 1 videodev
serio_raw 16384 0
pcspkr 16384 0
evdev 24576 6
i2c_algo_bit 16384 1 nouveau
osst 57344 0
st 57344 0
snd_hda_codec_realtek 90112 1
snd_hda_codec_generic 69632 1 snd_hda_codec_realtek
sg 32768 0
snd_hda_intel 36864 3
snd_hda_codec 135168 3 snd_hda_intel,snd_hda_codec_generic,snd_hda_codec_realtek
snd_hda_core 81920 4 snd_hda_intel,snd_hda_codec,snd_hda_codec_generic,snd_hda_codec_realtek
snd_hwdep 16384 1 snd_hda_codec
shpchp 36864 0
lpc_ich 24576 0
mfd_core 16384 1 lpc_ich
snd_pcm 110592 4 snd_hda_intel,snd_hda_codec,snd_hda_core,usbtv
snd_timer 32768 1 snd_pcm
snd 86016 16 snd_hda_intel,snd_hwdep,snd_hda_codec,usbtv,snd_timer,snd_hda_codec_generic,snd_hda_codec_realtek,snd_pcm
soundcore 16384 1 snd
button 16384 1 nouveau
acpi_cpufreq 20480 0
parport_pc 28672 1
ppdev 20480 0
lp 20480 0
parport 49152 3 lp,parport_pc,ppdev
ip_tables 24576 0
x_tables 36864 1 ip_tables
autofs4 40960 2
ext4 585728 1
crc16 16384 1 ext4
jbd2 106496 1 ext4
crc32c_generic 16384 2
fscrypto 28672 1 ext4
ecb 16384 0
glue_helper 16384 0
lrw 16384 0
gf128mul 16384 1 lrw
ablk_helper 16384 0
cryptd 24576 1 ablk_helper
aes_x86_64 20480 1
mbcache 16384 2 ext4
hid_generic 16384 0
usbhid 53248 0
hid 122880 2 hid_generic,usbhid
sr_mod 24576 0
sd_mod 45056 3
cdrom 61440 1 sr_mod
ata_generic 16384 0
i2c_i801 24576 0
i2c_smbus 16384 1 i2c_i801
ata_piix 36864 2
aic7xxx 126976 0
scsi_transport_spi 32768 1 aic7xxx
pata_jmicron 16384 0
libata 249856 3 ata_piix,pata_jmicron,ata_generic
scsi_mod 225280 8 aic7xxx,st,sd_mod,osst,libata,scsi_transport_spi,sr_mod,sg
r8169 81920 0
mii 16384 1 r8169
ehci_pci 16384 0
uhci_hcd 45056 0
ehci_hcd 81920 1 ehci_pci
usbcore 249856 5 usbhid,ehci_hcd,usbtv,uhci_hcd,ehci_pci
usb_common 16384 1 usbcore
user@debian:~$
mpv version:
user@debian:~$ mpv --version
mpv 0.23.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 55.34.101
libavcodec 57.64.101
libavformat 57.56.101
libswscale 4.2.100
libavfilter 6.65.100
libswresample 2.3.100
ffmpeg version: 3.2.5-1
user@debian:~$ mpv /dev/video0
Playing: /dev/video0
Failed to recognize file format.
Exiting... (Errors when loading file)
user@debian:~$
Play yellow RCA input.
error message
dmesg:
[ 559.404021] usb 6-4: new high-speed USB device number 5 using ehci-pci
[ 559.557016] usb 6-4: config 1 interface 0 altsetting 1 bulk endpoint 0x83 has invalid maxpacket 256
[ 559.559885] usb 6-4: New USB device found, idVendor=1b71, idProduct=3002
[ 559.559889] usb 6-4: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[ 559.559892] usb 6-4: Product: usbtv007
[ 559.559894] usb 6-4: Manufacturer: fushicai
[ 559.559896] usb 6-4: SerialNumber: 300000000002
[ 559.561667] usbtv 6-4:1.0: Fushicai USBTV007 Audio-Video Grabber
mpv logfile:
[ 0.004][v][cplayer] Command line options: '/dev/video0' '--log-file=mpvlog.txt'
[ 0.004][v][cplayer] mpv 0.23.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
[ 0.004][v][cplayer] built on UNKNOWN
[ 0.004][v][cplayer] ffmpeg library versions:
[ 0.004][v][cplayer] libavutil 55.34.101
[ 0.005][v][cplayer] libavcodec 57.64.101
[ 0.005][v][cplayer] libavformat 57.56.101
[ 0.005][v][cplayer] libswscale 4.2.100
[ 0.005][v][cplayer] libavfilter 6.65.100
[ 0.005][v][cplayer] libswresample 2.3.100
[ 0.005][v][cplayer] ffmpeg version: 3.2.5-1
[ 0.005][v][cplayer]
[ 0.005][v][cplayer] Configuration: ./waf configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --confdir=/etc/mpv --zshdir=/usr/share/zsh/vendor-completions --enable-cdda --enable-sdl2 --enable-sndio --enable-zsh-comp --enable-libmpv-shared --enable-encoding --disable-build-date
[ 0.005][v][cplayer] List of enabled features: alsa any-gl asm atomics audio-input avcodec-chroma-pos-api avframe-metadata avframe-skip-samples avutil-mastering-metadata c11-tls cdda cplayer debug-build dlopen drm dvbin dvdnav dvdread egl-drm egl-helpers egl-x11 encoding fchmod gbm gbm.h gcc-tls gl gl-wayland gl-x11 glibc-thread-name glob gnuc iconv jack jpeg lcms2 libass libass-osd libav libavdevice libavfilter libbluray libdl libm libmpv-shared librt libsmbclient libswresample libv4l2 linux-fstatfs lua nanosleep optimize oss-audio oss-audio-native plain-gl posix posix-or-mingw posix-spawn pthreads pulse resampler rubberband sdl2 shm sndio sse4-intrinsics standard-gl stdatomic subprocess termios tv tv-v4l2 vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-hwaccel vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vdpau-hwaccel videodev vt.h wayland x11 xext xinerama xrandr xss xv zlib zsh-comp
[ 0.005][v][cplayer] Setting option 'log-file' = 'mpvlog.txt' (flags = 8)
[ 0.006][v][global] user path: 'mpvlog.txt' -> 'mpvlog.txt'
[ 0.006][v][osc] Loading script @osc.lua...
[ 0.006][v][global] config path: 'scripts' -/-> '/home/user/.config/mpv/scripts'
[ 0.006][v][global] config path: 'scripts' -/-> '/home/user/.mpv/scripts'
[ 0.006][v][global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[ 0.006][v][osc] loading mp.defaults
[ 0.007][v][osc] loading @osc.lua
[ 0.010][v][global] config path: 'lua-settings/osc.conf' -/-> '/home/user/.config/mpv/lua-settings/osc.conf'
[ 0.010][v][global] config path: 'lua-settings/osc.conf' -/-> '/home/user/.mpv/lua-settings/osc.conf'
[ 0.010][v][global] config path: 'lua-settings/osc.conf' -/-> '/etc/mpv/lua-settings/osc.conf'
[ 0.010][v][osc] lua-settings/osc.conf not found.
[ 0.011][v][cplayer] Run command: define-section, flags=0, args=[showhide, mouse_move script-binding osc/__keybinding1
[ 0.011][v][cplayer] mouse_leave script-binding osc/__keybinding2
[ 0.011][v][cplayer] , force]
[ 0.011][v][cplayer] Run command: enable-section, flags=0, args=[showhide, allow-hide-cursor+allow-vo-dragging]
[ 0.011][v][cplayer] Run command: define-section, flags=0, args=[input, mouse_btn0 script-binding osc/__keybinding3
[ 0.011][v][cplayer] shift+mouse_btn0 script-binding osc/__keybinding4
[ 0.011][v][cplayer] mouse_btn2 script-binding osc/__keybinding5
[ 0.011][v][cplayer] mouse_btn0_dbl ignore
[ 0.011][v][cplayer] shift+mouse_btn0_dbl ignore
[ 0.011][v][cplayer] mouse_btn2_dbl ignore
[ 0.011][v][cplayer] , force]
[ 0.011][v][cplayer] Run command: enable-section, flags=0, args=[input, ]
[ 0.011][v][cplayer] Run command: define-section, flags=0, args=[input_osc, del script-binding osc/__keybinding6
[ 0.011][v][cplayer] , default]
[ 0.011][v][cplayer] Run command: enable-section, flags=0, args=[input_osc, allow-hide-cursor+allow-vo-dragging]
[ 0.011][v][cplayer] Run command: define-section, flags=0, args=[input_forced_osc, , force]
[ 0.011][v][cplayer] Run command: enable-section, flags=0, args=[input_forced_osc, allow-hide-cursor+allow-vo-dragging]
[ 0.011][v][cplayer] Done loading @osc.lua.
[ 0.011][v][ytdl_hook] Loading script @ytdl_hook.lua...
[ 0.011][v][cplayer] Run command: disable-section, flags=0, args=[input]
[ 0.011][v][global] config path: 'fonts' -/-> '/home/user/.config/mpv/fonts'
[ 0.011][v][global] config path: 'fonts' -/-> '/home/user/.mpv/fonts'
[ 0.011][v][global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[ 0.012][v][osd/libass] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.4.2 (COMPLEX)
[ 0.012][v][global] config path: 'subfont.ttf' -/-> '/home/user/.config/mpv/subfont.ttf'
[ 0.012][v][global] config path: 'subfont.ttf' -/-> '/home/user/.mpv/subfont.ttf'
[ 0.012][v][global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[ 0.012][v][global] config path: 'fonts.conf' -/-> '/home/user/.config/mpv/fonts.conf'
[ 0.012][v][global] config path: 'fonts.conf' -/-> '/home/user/.mpv/fonts.conf'
[ 0.012][v][global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[ 0.012][v][osd/libass] Setting up fonts...
[ 0.016][v][global] config path: 'scripts' -/-> '/home/user/.config/mpv/scripts'
[ 0.016][v][global] config path: 'scripts' -/-> '/home/user/.mpv/scripts'
[ 0.016][v][global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[ 0.016][v][ytdl_hook] loading mp.defaults
[ 0.017][v][osd/libass] Using font provider fontconfig
[ 0.017][v][osd/libass] Done.
[ 0.018][v][ytdl_hook] loading @ytdl_hook.lua
[ 0.018][v][cplayer] Run command: hook-add, flags=0, args=[on_load, 1, 10]
[ 0.018][v][cplayer] Run command: hook-add, flags=0, args=[on_preloaded, 2, 10]
[ 0.018][v][cplayer] Done loading @ytdl_hook.lua.
[ 0.018][v][global] config path: 'scripts' -/-> '/home/user/.config/mpv/scripts'
[ 0.018][v][global] config path: 'scripts' -/-> '/home/user/.mpv/scripts'
[ 0.018][v][global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[ 0.018][v][global] config path: 'watch_later' -> '/home/user/.config/mpv/watch_later'
[ 0.018][i][cplayer] Playing: /dev/video0
[ 0.018][v][cplayer] Running hook: ytdl_hook/on_load
[ 0.018][v][cplayer] Run command: hook-ack, flags=0, args=[on_load]
[ 0.018][v][ifo] Opening /dev/video0
[ 0.019][v][ifo/dvdnav] Opening /dev/video0
[ 0.019][v][bdmv/bluray] Opening /dev/video0
[ 0.020][v][file] Opening /dev/video0
[ 0.020][v][file] Stream opened successfully.
[ 0.020][v][demux] Trying demuxers for level=normal.
[ 0.437][v][lavf] No format found, try lowering probescore or forcing the format.
[ 0.438][v][demux] Trying demuxers for level=unsafe.
[ 0.706][v][lavf] No format found, try lowering probescore or forcing the format.
[ 0.736][v][cplayer] finished playback, unrecognized file format (reason 4)
[ 0.736][e][cplayer] Failed to recognize file format.
[ 0.736][i][cplayer]
[ 0.736][i][cplayer]
[ 0.736][i][cplayer] Exiting... (Errors when loading file)
[ 0.736][v][osc] Exiting...
[ 0.738][v][ytdl_hook] Exiting...
user@debian:~$
Try using mpv tv://. The man page specifies the default device as /dev/video0.
Thanks. It works.
The tv:// protocol is not available on Ubuntu in 2020. Apparently, av:// is to be used for v4l2 support:
mpv av://v4l2:/dev/video0
It supports many options, too:
mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0
Most helpful comment
Try using
mpv tv://. The man page specifies the default device as/dev/video0.