You are not logged in.

#1 2021-06-17 11:32:38

quellen
Member
From: Italy
Registered: 2014-05-24
Posts: 274

[Solved] mpv fails to play /dev/video0

hi,
mpv can't play my webcam:

$ mpv av://v4l2:/dev/video0
[ffmpeg/demuxer] video4linux2,v4l2: Cannot find a proper format for codec 'none' (id 0), pixel format 'none' (id -1)
[lavf] avformat_open_input() failed
Failed to recognize file format.

Exiting... (Errors when loading file)
$ for VIDEO_DEVICE in /dev/video0 ; do echo -e "\n\n$VIDEO_DEVICE\n" ; v4l2-ctl --device=$VIDEO_DEVICE --list-inputs ; done


/dev/video0

ioctl: VIDIOC_ENUMINPUT
	Input       : 0
	Name        : pac7311
	Type        : 0x00000002 (Camera)
	Audioset    : 0x00000000
	Tuner       : 0x00000000
	Standard    : 0x0000000000000000 ()
	Status      : 0x00000020 (vflip)
	Capabilities: 0x00000000 (not defined)
$ ffmpeg -f v4l2 -list_formats all -i /dev/video0
ffmpeg version n4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[video4linux2,v4l2 @ 0x55b9caca7a81] Compressed: Unsupported :           GSPCA PJPG : 160x120 320x240 640x480
/dev/video0: Immediate exit requested

with VLC it works (i use "vlc v4l2://")

Last edited by quellen (2021-06-17 12:56:39)


sorry for my bad english

Offline

#2 2021-06-17 12:33:24

progandy
Member
Registered: 2012-05-17
Posts: 5,192

Re: [Solved] mpv fails to play /dev/video0

It seems like the camera only sends "pjpg" encoded images and that is not supported by ffmpeg.
You can try it with

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so application

https://wiki.archlinux.org/title/Webcam_setup

By the way, Is the best resolution of that webcam 640x480?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2021-06-17 12:56:15

quellen
Member
From: Italy
Registered: 2014-05-24
Posts: 274

Re: [Solved] mpv fails to play /dev/video0

progandy wrote:

It seems like the camera only sends "pjpg" encoded images and that is not supported by ffmpeg.
You can try it with

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so application

https://wiki.archlinux.org/title/Webcam_setup

thank you. Now it works!

progandy wrote:

By the way, Is the best resolution of that webcam 640x480?

yes, it's a very old webcam!

Last edited by quellen (2021-06-17 12:56:51)


sorry for my bad english

Offline

Board footer

Powered by FluxBB