mpv-player / mpv

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

Video and audio lag when using v4l2 with audio file #9595

Closed s0301132 closed 1 year ago

s0301132 commented 2 years ago

Important Information

Provide following Information:

- Linux Distribution and Version

Ubuntu 18.04.6 LTS aarch64 NVIDIA Jetson Xavier NX Develo 4.9.253-tegra


### Reproduction steps and actual behavior
According to this page [v4l Input](https://github.com/mpv-player/mpv/wiki/Video4Linux2-Input) I want to stream video from video capture card `dev/video0`, if only using `v4l2` it can play smoothly.
`mpv av://v4l2:/dev/video0 --profile=low-latency`

But after adding audio file both video and audio are laggy with lots of drop frame.

mpv av://v4l2:/dev/video0 --audio-file=av://pulse:alsa_input.usb-AVerMedia_Live_Gamer_Ultra-Video_5310975600762-02.analog-stereo --demuxer-lavf-o=timestamps=abs


Terminal output.

Audio device underrun detected. AV: 455390:42:46 / 455390:42:46 (100%) A-V: 0.000 ct: 0.673 Dropped: 41 Audio device underrun detected. AV: 455390:42:47 / 455390:42:48 (100%) A-V: 0.000 ct: 0.673 Dropped: 41 Audio device underrun detected. AV: 455390:42:49 / 455390:42:50 (100%) A-V: 0.000 ct: 0.673 Dropped: 41 Audio device underrun detected. AV: 455390:42:51 / 455390:42:52 (100%) A-V: 0.000 ct: 0.673 Dropped: 41 Audio device underrun detected. AV: 455390:42:53 / 455390:42:54 (100%) A-V: 0.000 ct: 0.673 Dropped: 41 Audio device underrun detected.



### Expected behavior
Both video and audio play smoothly
s0301132 commented 2 years ago

I follow #8367 and config my PulseAudio now both video and audio can play smoothly. However it only works on system wise setting /etc/pulse but not user config /.config/pulse

Dudemanguy commented 1 year ago

Original reporter said he solved it (might be still an mpv bug somewhere but we'll close this for now).