Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
1
answers
2724
views
How to queue up videos or media using mpv?
In particular I'd like a command for mpv that will automatically play youtube links I add in order. For example, at a party I might want to queue up songs as we think of them, and have them automatically play.
In particular I'd like a command for mpv that will automatically play youtube links I add in order. For example, at a party I might want to queue up songs as we think of them, and have them automatically play.
dessalines
(161 rep)
Jun 18, 2018, 10:58 PM
• Last activity: May 18, 2025, 05:08 AM
1
votes
0
answers
140
views
MPV crashes because of segmentation fault when play certain mp4
For some reasons, I can't get to play certain mp4 files downloaded from Microsoft Teams. It could play those files, but it started crashing randomly. I'm on arch linux and I suspect it is because of an update, so here's all the packages I updated before I started getting this problem: - alsa-card-pr...
For some reasons, I can't get to play certain mp4 files downloaded from Microsoft Teams. It could play those files, but it started crashing randomly. I'm on arch linux and I suspect it is because of an update, so here's all the packages I updated before I started getting this problem:
- alsa-card-profiles -> (1:1.2.7-1)
- htop -> (3.3.0-3)
- libx11 -> (1.8.11-1)
- imagemagick -> (7.1.1.44-1)
- libpipewire -> (1:1.2.7-1)
- libsm -> (1.2.5-1)
- libsynctex -> (2024.2-6)
- linux -> (6.13.5.arch1-1)
- pipewire -> (1:1.2.7-1)
- pipewire-audio -> (1:1.2.7-1)
- pipewire-session-manager -> (1:1.2.7-1)
- pipewire-alsa -> (1:1.2.7-1)
- pipewire-jack -> (1:1.2.7-1)
- pipewire-pulse -> (1:1.2.7-1)
- xorg-xauth -> (1.1.3-1)
I tried playing different files and different mp4 and they all worked, but I really need to get mpv working again with these files.
I tried installing mpv-git from the AUR, but it didn't help. Do you have any idea what could be the problem? Let me know if specific command outputs are needed to have a better insight of the problem.
Here is some more info and clarifications:
- The exact same file can be played on the same exact machine with vlc.
- I tried redownloading the file and also tried different files downloaded from MS Teams and they all stopped working on this machine.
- Here is the crash dialogue from mpv:
61624 segmentation fault (core dumped) mpv Video/Lezione\ 8\ -\ 08_03_2023.mp4
- The same files can be played on a different machine with mpv. This other machine uses Ubuntu with mpv version 0.34.1, while the machine where files are not playing uses mpv 0.39.0. Here is the output for mpv -version on the machine where files are not playing correctly:
mpv v0.39.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects built on Nov 27 2024 18:31:26
libplacebo version: v7.349.0
FFmpeg version: n7.1
FFmpeg library versions:
libavcodec 61.19.100
libavdevice 61.3.100
libavfilter 10.4.100
libavformat 61.7.100
libavutil 59.39.100
libswresample 5.3.100
libswscale 8.3.100
## "Solution" ##
I find out that using mpv --ao=alsa file.mp4, the problem does not occur, so it seems to be caused by the recent updates to pipewire.
## Actual solution ##
Most recent update for pipewire and related packages solved the issue.
deomanu01
(51 rep)
Mar 12, 2025, 10:26 AM
• Last activity: Mar 15, 2025, 08:04 AM
2
votes
1
answers
1547
views
mpv fails to play youtube videos
I've been using mpv for a while, but now whenever I try to play a youtube video the following output shows up: [ffmpeg] https: HTTP error 403 Forbidden Failed to open https://rr5. . . EDL: Could not open source file: 'https://rr5. . .' No video or audio streams selected. Oddly, I can play videos on...
I've been using mpv for a while, but now whenever I try to play a youtube video the following output shows up:
[ffmpeg] https: HTTP error 403 Forbidden
Failed to open https://rr5 . . .
EDL: Could not open source file: 'https://rr5 . . .'
No video or audio streams selected.
Oddly, I can play videos on other platforms, such as Odysee and Rumble. I've looked for answers in this substack and elsewhere and haven't found a solution for this specifically.
Ash
(185 rep)
Jan 14, 2024, 06:26 PM
• Last activity: Feb 10, 2025, 06:30 AM
1
votes
1
answers
448
views
Play two videos in sync frame by frame with different starting positions
I want to compare two videos (with different resolutions) and want to go though both videos frame by frame (forward and backward) in sync. I managed to do so using ``` mpv somevideo720.mkv --external-file=somevideo1080.mkv --lavfi-complex='[vid1] scale=960x540 [vid1_scale]; [vid2] scale=960x540 [vid...
I want to compare two videos (with different resolutions) and want to go though both videos frame by frame (forward and backward) in sync.
I managed to do so using
mpv somevideo720.mkv --external-file=somevideo1080.mkv --lavfi-complex='[vid1] scale=960x540 [vid1_scale]; [vid2] scale=960x540 [vid2_scale]; [vid1_scale][vid2_scale] hstack [vo]'
(compare [here](https://github.com/mpv-player/mpv/issues/3854#issuecomment-571424357))
However I also want to set up two different starting positions of the videos. How can I do this without modifying the videos itself?
The best solution would be if it would be possible to open both videos, navigate in both videos to the desired starting position, then go into "sync mode"...
student
(18865 rep)
Nov 4, 2023, 06:48 PM
• Last activity: Jan 26, 2025, 12:01 PM
7
votes
2
answers
18087
views
Stream Youtube with mpv starting at an arbitrary point later in the video
I prefer streaming Youtube videos via `mpv`, mpv https://www.youtube.com/watch?v= However, for long videos sometimes the audio breaks down in the middle, leaving error messages like > [ffmpeg] tls: Error in the pull function. Restarting the video is starting it from the beginning. How can I either d...
I prefer streaming Youtube videos via
mpv
,
mpv https://www.youtube.com/watch?v=
However, for long videos sometimes the audio breaks down in the middle, leaving error messages like
> [ffmpeg] tls: Error in the pull function.
Restarting the video is starting it from the beginning. How can I either directly in the command line start from, let's say, minute 30, or alternatively jump in the mpv
interface to minute 30 *without* pressing 30 times the up button (which also has issues if done too fast)?
I haven't found an answer related to that issue in the man page. Is it possible at all?
Also alternative suggestions for streaming are welcome.
jjdb
(121 rep)
May 12, 2017, 11:02 AM
• Last activity: Dec 17, 2024, 03:51 PM
4
votes
2
answers
661
views
I want to write a script that simultaneously renders what's on my webcam to a window on my screen and records a video
I have tried a combination of: * v4l2loopback * ffmpeg * mpv But either the web-cam view, or the web-cam record works, but never both together. Can anyone provide a script that achieves this? This is what I've tried so far: ```bash #!/usr/bin/env bash set -x # This needs the video loopback module to...
I have tried a combination of:
* v4l2loopback
* ffmpeg
* mpv
But either the web-cam view, or the web-cam record works, but never both together.
Can anyone provide a script that achieves this?
This is what I've tried so far:
#!/usr/bin/env bash
set -x
# This needs the video loopback module to be installed.
# sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="VirtualCam" exclusive_caps=1
# use pw-cli list-objects | grep node.name
to get the audio device
AUDIO_DEVICE="alsa_input.pci-0000_00_1f.3.analog-stereo"
VIDEO_DEVICE="/dev/video0"
VIRTUAL_VIDEO_DEVICE="/dev/video10"
read -p "Enter a name for the video: " VIDEO_NAME
if [ -z "$VIDEO_NAME" ]; then
VIDEO_NAME="unnamed_video"
fi
OUTPUT_FILE="$HOME/videos/${VIDEO_NAME}_$(date +%Y%m%d_%H%M%S).mkv"
trap 'echo "Stopping recording..."; pkill -P $$; exit 0' SIGINT
ffmpeg -f v4l2 -framerate 30 -video_size 640x480 -i "$VIDEO_DEVICE" \
-f v4l2 -video_size 640x480 -i "$VIRTUAL_VIDEO_DEVICE" &
sleep 2
# Start displaying the virtual webcam feed with mpv
mpv --no-osc \
--no-input-default-bindings \
--profile=low-latency \
--geometry=50%:50% \
--autofit=100% \
--input-conf=/dev/null \
--title='WebcamDisplay' \
--framedrop=no \
--vf=scale=640:-1 \
--vo=vaapi \
"$VIRTUAL_VIDEO_DEVICE" &
# Start recording from the virtual device with ffmpeg
ffmpeg -f v4l2 -framerate 30 -video_size 640x480 -i "$VIRTUAL_VIDEO_DEVICE" \
-f pulse -i "$AUDIO_DEVICE" \
-c:v libx264 -preset ultrafast -crf 28 -pix_fmt yuv420p \
-c:a aac -b:a 192k -ar 48000 \
"$OUTPUT_FILE"
# Stop all processes when done
pkill ffmpeg
pkill mpv
This is my loopback setup:
$ v4l2-ctl --list-devices
VirtualCam (platform:v4l2loopback-010):
/dev/video10
Integrated_Webcam_HD: Integrate (usb-0000:00:14.0-12):
/dev/video0
/dev/video1
/dev/media0
Brad
(331 rep)
Sep 10, 2024, 11:24 AM
• Last activity: Nov 24, 2024, 02:16 PM
0
votes
2
answers
29
views
Artifacts when MPV plays same file located on another disk
I'm facing a peculiar issue. I've copied media file to USB flash (using Linux Mint). Now when this files is played by `mpv` at one point it freezes for some time displaying what looks like green foreign language symbols all over the screen (and no subtitles after unfreeze). When played from initial...
I'm facing a peculiar issue. I've copied media file to USB flash (using Linux Mint). Now when this files is played by
mpv
at one point it freezes for some time displaying what looks like green foreign language symbols all over the screen (and no subtitles after unfreeze). When played from initial disk it plays fine. Hashes as calculated in terminal are same.
I wonder how playing same file can lead to different results.
Martian2020
(1443 rep)
Nov 4, 2024, 09:10 AM
• Last activity: Nov 4, 2024, 01:40 PM
2
votes
3
answers
4822
views
In mpv, how can I start playback at a random moment of a playlist?
In `mpv`, there's the [`--start`][1] switch, which allows me to provide a number of seconds to skip. This way I can start playback at a random moment in a single file. And there's [`--shuffle`][2] which allows me to start playback at a random file within a given playlist. I combine both to: 1. choos...
In
mpv
, there's the --start
switch, which allows me to provide a number of seconds to skip. This way I can start playback at a random moment in a single file.
And there's --shuffle
which allows me to start playback at a random file within a given playlist.
I combine both to:
1. choose a random file and
2. start playback at a random moment in that file
with this command line:
mpv --shuffle --start $POSITION --playlist=/tmp/list.m3u
### Issue
However, the --start
parameter will be considered for each and every file that follows later on in the list as well and those will also have their first X seconds skipped. I don't want that.
### What I tried
Currently I invoke mpv
twice, in sequence, but that's ugly.
### Questions
Is there a way to have --start
only affect the very first file played?
Or, even better, get mpv at a completely random moment in the random playlist. So, if the list is 123 minutes, it would start at 31 minutes 13 seconds, regardless of how far or not that would be into the file.
user569825
(537 rep)
Jul 10, 2019, 04:34 PM
• Last activity: Oct 6, 2024, 04:10 PM
1
votes
3
answers
11725
views
How can I control mpv in command line?
How can I control `mpv` in command line? Like is there a `mpv next/prev` command that I can use to play next or previous media file?
How can I control
mpv
in command line?
Like is there a mpv next/prev
command that I can use to play next or previous media file?
Mahdy Mirzade
(141 rep)
Aug 15, 2021, 06:36 AM
• Last activity: Aug 26, 2024, 12:55 PM
0
votes
1
answers
49
views
Starting application with I/O redirection via *.desktop file
I start music or video with right click and "open with" in Thunar (Xfce). For every entry, there is a `*.desktop` file in `~/.local/share/applications` or `/usr/share/applications`. I want to start an application with a pipe and save the output in a file. This works in terminal: mpv file.mp4 > log 2...
I start music or video with right click and "open with" in Thunar (Xfce). For every entry, there is a
*.desktop
file in ~/.local/share/applications
or /usr/share/applications
. I want to start an application with a pipe and save the output in a file.
This works in terminal:
mpv file.mp4 > log 2>&1
But that doesn't work when I add the same line to the desktop file:
Exec=mpv file.mp4 > log 2>&1
The file is started, but there is no output. How can I do this? Is there something special when using desktop files? also starting with terminal=true
, but that didn't work.
fmeier
(361 rep)
Aug 13, 2024, 08:37 PM
• Last activity: Aug 15, 2024, 04:27 AM
2
votes
1
answers
100
views
Playing random videos on one's system; minor improvement to include DVDs
In my .bashrc I have a function which I use to play random videos (not written below, just fyi), and another one for all media files, e.g.: createmediafiles() { find ~+ -type f -iregex '.*\.\(mp3\|wav\|ogg\|flac\|mp4\|mov\|avi\)' > ~/mediafiles.txt find ~+ -type d -name VIDEO_TS >> ~+/mediafiles.txt...
In my .bashrc I have a function which I use to play random videos (not written below, just fyi), and another one for all media files, e.g.:
createmediafiles() {
find ~+ -type f -iregex '.*\.\(mp3\|wav\|ogg\|flac\|mp4\|mov\|avi\)' > ~/mediafiles.txt
find ~+ -type d -name VIDEO_TS >> ~+/mediafiles.txt
}
playmediafiles() {
while true; do
while read -r line; do
shuf -n 1 |
tee -a ~/played-log.txt |
xargs -d "\n" mpv
done < ~/mediafiles.txt
done
}
I want to add the VIDEO_TS line to
createmediafiles
, but in the playmediafiles
function I want to add an IF statement, such that if the line shuffled to in mediafiles.txt
is a VIDEO_TS then rather than using mpv to play a file, it will do:
tee -a ~/played-log.txt | xargs -d "\n" vlc --fullscreen
Piping in mediafiles.txt
read the same way as it does with mpv.
How do I throw that in an IF statement with the condition being that the line ends in VIDEO_TS?
1toneboy
(465 rep)
Mar 26, 2024, 09:38 AM
• Last activity: Mar 28, 2024, 10:04 AM
2
votes
1
answers
436
views
How do you configure a V4L2 device when V4L2 software cannot read a V4L2 stream directly, because they give IO errors?
I'm trying to capture video from an [Elikliv UVC microscope][1] in Linux. We can do direct frame-by-frame capture using this command: ```sh v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=stream.mjpg ``` ... and I can see it live using this big crazy command: ```sh v4l2-ctl --device /dev/vid...
I'm trying to capture video from an Elikliv UVC microscope in Linux.
We can do direct frame-by-frame capture using this command:
v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=stream.mjpg
... and I can see it live using this big crazy command:
v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=/proc/self/fd/1 | \
ffmpeg -i - -fflags discardcorrupt -c:v copy -f matroska - | \
mpv --profile=low-latency -
..but I can't get it to work directly with V4L2-aware software (ie, MPV, VLC, OBS) without the help of v4l2-ctl
to stream it into ffmpeg
and then mpv
.
## **Question:**
Is there a way I can tell configure the V4L2 device to work in a "normal" way, directly from /dev/video0
, without a big crazy pipe?
## MPV says
# mpv /dev/video0
[lavf] avformat_open_input() failed
Failed to recognize file format.
## VLC says
Your input can't be opened:
VLC is unable to open the MRL 'v4l2:///dev/video0'. Check the log for details.
[00007efbdc001120] v4l2 demux error: cannot set format: Input/output error
[00007efbdc001120] v4l2 demux error: not a radio tuner device
[00007efbdc003710] v4l2 stream error: cannot set format: Input/output error
## Other misc info:
# dmesg
[ +0.078764] usb 1-4.3: New USB device found, idVendor=05e3, idProduct=f12b, bcdDevice= 1.00
[ +0.000019] usb 1-4.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ +0.000008] usb 1-4.3: Product: GENERAL - UVC
[ +0.000006] usb 1-4.3: Manufacturer: GENERAL
[ +0.002536] usb 1-4.3: Found UVC 1.00 device GENERAL - UVC (05e3:f12b)
[ +0.000287] usb 1-4.3: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ +5.549774] retire_capture_urb: 233 callbacks suppressed
[ +5.000996] retire_capture_urb: 4991 callbacks suppressed
[ +5.000956] retire_capture_urb: 4991 callbacks suppressed
[ +5.001062] retire_capture_urb: 4991 callbacks suppressed
... ...
[ +3.438372] uvcvideo 1-4.3:1.1: Failed to query (130) UVC probe control : -32 (exp. 26).
# v4l2-ctl --list-devices
GENERAL - UVC : GENERAL - UVC (usb-0000:00:14.0-4.3):
/dev/video0
/dev/video1
/dev/media0
# v4l2-ctl --list-formats -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
# v4l2-ctl --list-formats -d /dev/video1
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
# v4l2-ctl --list-formats -d /dev/media0
Unable to detect what device /dev/media0 is, exiting.
# v4l2-ctl -D -d /dev/video0
Driver Info:
Driver name : uvcvideo
Card type : GENERAL - UVC : GENERAL - UVC
Bus info : usb-0000:00:14.0-4.3
Driver version : 6.7.6
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : GENERAL - UVC : GENERAL - UVC
Serial :
Bus info : usb-0000:00:14.0-4.3
Media version : 6.7.6
Hardware revision: 0x00000100 (256)
Driver version : 6.7.6
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : GENERAL - UVC : GENERAL - UVC
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x02000010: from remote pad 0x100000a of entity 'Processing 5': Data, Enabled, Immutable
# v4l2-ctl -D -d /dev/video1
Driver Info:
Driver name : uvcvideo
Card type : GENERAL - UVC : GENERAL - UVC
Bus info : usb-0000:00:14.0-4.3
Driver version : 6.7.6
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04a00000
Metadata Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : GENERAL - UVC : GENERAL - UVC
Serial :
Bus info : usb-0000:00:14.0-4.3
Media version : 6.7.6
Hardware revision: 0x00000100 (256)
Driver version : 6.7.6
Interface Info:
ID : 0x03000005
Type : V4L Video
Entity Info:
ID : 0x00000004 (4)
Name : GENERAL - UVC : GENERAL - UVC
Function : V4L2 I/O
## MPV Verbose output:
# mpv av://v4l2:/dev/video0 --profile=low-latency --untimed --demuxer-lavf-o=video_size=1280x720,input_format=mjpeg -v -v
[cplayer] Command line options: 'av://v4l2:/dev/video0' '--profile=low-latency' '--untimed' '--demuxer-lavf-o=video_size=1280x720,input_format=mjpeg' '-v' '-v'
[cplayer] mpv 0.35.1 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
[cplayer] built on UNKNOWN
[cplayer] FFmpeg library versions:
[cplayer] libavutil 57.28.100
[cplayer] libavcodec 59.37.100
[cplayer] libavformat 59.27.100
[cplayer] libswscale 6.7.100
[cplayer] libavfilter 8.44.100
[cplayer] libswresample 4.7.100
[cplayer] FFmpeg version: 5.1.3
[cplayer]
[cplayer] Configuration: /usr/bin/waf configure --prefix=/usr --bindir=/usr/bin --libdir=/usr/lib64 --mandir=/usr/share/man --docdir=/usr/share/doc/mpv --confdir=/etc/mpv --disable-build-date --enable-libmpv-shared --enable-sdl2 --enable-libarchive --enable-dvdnav --enable-cdda --enable-html-build --enable-dvbin --enable-gl-x11 --enable-wayland
[cplayer] List of enabled features: alsa asm av-channel-layout caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build dmabuf-interop-gl dmabuf-interop-pl dmabuf-wayland drm drm-is-kms dvbin dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo librt linux-fstatfs linux-input-event-codes lua lua_5_1 memfd_create optimize pipewire plain-gl posix posix-or-mingw pthreads pulse rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-libplacebo vaapi-wayland vaapi-x-egl vaapi-x11 vapoursynth vdpau vdpau-gl-x11 vector vt.h vulkan wayland wayland-protocols wayland-protocols-1-24 x11 xv zimg zlib
[global] config path: '' -> '/root/.config/mpv'
[global] user path: '~~home/' -> '/root/.config/mpv'
[global] user path: '~~old_home/' -> '/root/.mpv'
[global] config path: 'encoding-profiles.conf' -/-> '/root/.config/mpv/encoding-profiles.conf'
[global] config path: 'encoding-profiles.conf' -/-> '/root/.mpv/encoding-profiles.conf'
[global] config path: 'encoding-profiles.conf' -> '/etc/mpv/encoding-profiles.conf'
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[global] config path: 'mpv.conf' -/-> '/root/.config/mpv/mpv.conf'
[global] config path: 'config' -/-> '/root/.config/mpv/config'
[global] config path: 'mpv.conf' -/-> '/root/.mpv/mpv.conf'
[global] config path: 'config' -/-> '/root/.mpv/config'
[global] config path: 'mpv.conf' -/-> '/etc/mpv/mpv.conf'
[global] config path: 'config' -/-> '/etc/mpv/config'
[cplayer] Setting option 'profile' = 'low-latency' (flags = 8)
[cplayer] Applying profile 'low-latency'...
[cplayer] Setting option 'audio-buffer' = '0' (flags = 12)
[cplayer] Setting option 'vd-lavc-threads' = '1' (flags = 12)
[cplayer] Setting option 'cache-pause' = 'no' (flags = 12)
[cplayer] Setting option 'demuxer-lavf-o-add' = 'fflags=+nobuffer' (flags = 12)
[cplayer] Setting option 'demuxer-lavf-probe-info' = 'nostreams' (flags = 12)
[cplayer] Setting option 'demuxer-lavf-analyzeduration' = '0.1' (flags = 12)
[cplayer] Setting option 'video-sync' = 'audio' (flags = 12)
[cplayer] Setting option 'interpolation' = 'no' (flags = 12)
[cplayer] Setting option 'video-latency-hacks' = 'yes' (flags = 12)
[cplayer] Setting option 'stream-buffer-size' = '4k' (flags = 12)
[cplayer] Setting option 'untimed' = '' (flags = 8)
[cplayer] Setting option 'demuxer-lavf-o' = 'video_size=1280x720,input_format=mjpeg' (flags = 8)
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Setting option 'v' = '' (flags = 8)
[global] config path: 'input.conf' -/-> '/root/.config/mpv/input.conf'
[global] config path: 'input.conf' -/-> '/root/.mpv/input.conf'
[global] config path: 'input.conf' -/-> '/etc/mpv/input.conf'
[osc] Loading lua script @osc.lua...
[ytdl_hook] Loading lua script @ytdl_hook.lua...
[stats] Loading lua script @stats.lua...
[console] Loading lua script @console.lua...
[osc] loading mp.defaults
[auto_profiles] Loading lua script @auto_profiles.lua...
[ytdl_hook] loading mp.defaults
[global] config path: 'scripts' -/-> '/root/.config/mpv/scripts'
[stats] loading mp.defaults
[global] config path: 'scripts' -/-> '/root/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[cplayer] Waiting for scripts...
[auto_profiles] loading mp.defaults
[console] loading mp.defaults
[osc] loading @osc.lua
[stats] loading @stats.lua
[auto_profiles] loading @auto_profiles.lua
[console] loading @console.lua
[auto_profiles] Exiting...
[console] reading options for console
[global] config path: 'script-opts/console.conf' -/-> '/root/.config/mpv/script-opts/console.conf'
[global] config path: 'script-opts/console.conf' -/-> '/root/.mpv/script-opts/console.conf'
[global] config path: 'script-opts/console.conf' -/-> '/etc/mpv/script-opts/console.conf'
[console] script-opts/console.conf not found.
[global] config path: 'lua-settings/console.conf' -/-> '/root/.config/mpv/lua-settings/console.conf'
[global] config path: 'lua-settings/console.conf' -/-> '/root/.mpv/lua-settings/console.conf'
[global] config path: 'lua-settings/console.conf' -/-> '/etc/mpv/lua-settings/console.conf'
[console] lua-settings/console.conf not found.
[stats] reading options for stats
[global] config path: 'script-opts/stats.conf' -/-> '/root/.config/mpv/script-opts/stats.conf'
[global] config path: 'script-opts/stats.conf' -/-> '/root/.mpv/script-opts/stats.conf'
[global] config path: 'script-opts/stats.conf' -/-> '/etc/mpv/script-opts/stats.conf'
[stats] script-opts/stats.conf not found.
[global] config path: 'lua-settings/stats.conf' -/-> '/root/.config/mpv/lua-settings/stats.conf'
[global] config path: 'lua-settings/stats.conf' -/-> '/root/.mpv/lua-settings/stats.conf'
[global] config path: 'lua-settings/stats.conf' -/-> '/etc/mpv/lua-settings/stats.conf'
[stats] lua-settings/stats.conf not found.
[ytdl_hook] loading @ytdl_hook.lua
[global] config path: 'fonts' -/-> '/root/.config/mpv/fonts'
[global] config path: 'fonts' -/-> '/root/.mpv/fonts'
[global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[osd/libass] ASS library version: 0x1701000 (runtime 0x1701000)
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[osd/libass] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[global] config path: 'subfont.ttf' -/-> '/root/.config/mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/root/.mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[global] config path: 'fonts.conf' -/-> '/root/.config/mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/root/.mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[osd/libass] Setting up fonts...
[ytdl_hook] reading options for ytdl_hook
[global] config path: 'script-opts/ytdl_hook.conf' -/-> '/root/.config/mpv/script-opts/ytdl_hook.conf'
[global] config path: 'script-opts/ytdl_hook.conf' -/-> '/root/.mpv/script-opts/ytdl_hook.conf'
[global] config path: 'script-opts/ytdl_hook.conf' -/-> '/etc/mpv/script-opts/ytdl_hook.conf'
[ytdl_hook] script-opts/ytdl_hook.conf not found.
[global] config path: 'lua-settings/ytdl_hook.conf' -/-> '/root/.config/mpv/lua-settings/ytdl_hook.conf'
[global] config path: 'lua-settings/ytdl_hook.conf' -/-> '/root/.mpv/lua-settings/ytdl_hook.conf'
[global] config path: 'lua-settings/ytdl_hook.conf' -/-> '/etc/mpv/lua-settings/ytdl_hook.conf'
[ytdl_hook] lua-settings/ytdl_hook.conf not found.
[osc] reading options for osc
[global] config path: 'script-opts/osc.conf' -/-> '/root/.config/mpv/script-opts/osc.conf'
[global] config path: 'script-opts/osc.conf' -/-> '/root/.mpv/script-opts/osc.conf'
[global] config path: 'script-opts/osc.conf' -/-> '/etc/mpv/script-opts/osc.conf'
[osc] script-opts/osc.conf not found.
[global] config path: 'lua-settings/osc.conf' -/-> '/root/.config/mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/root/.mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/etc/mpv/lua-settings/osc.conf'
[osc] lua-settings/osc.conf not found.
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Run command: define-section, flags=64, args=[name="input_stats", contents="", flags="default"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_stats", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_forced_stats", contents="", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_forced_stats", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_console", contents="", flags="default"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_console", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_forced_console", contents="", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_forced_console", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="showhide", contents="mouse_move script-binding osc/__keybinding1\nmouse_leave script-binding osc/__keybinding2\n", flags="force"]
[cplayer] Run command: define-section, flags=64, args=[name="showhide_wc", contents="mouse_move script-binding osc/__keybinding3\nmouse_leave script-binding osc/__keybinding4\n", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="showhide", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: enable-section, flags=64, args=[name="showhide_wc", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input", contents="mbtn_left script-binding osc/__keybinding5\nshift+mbtn_left script-binding osc/__keybinding6\nmbtn_right script-binding osc/__keybinding7\nmbtn_mid script-binding osc/__keybinding8\nwheel_up script-binding osc/__keybinding9\nwheel_down script-binding osc/__keybinding10\nmbtn_left_dbl ignore\nshift+mbtn_left_dbl ignore\nmbtn_right_dbl ignore\n", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input", flags=""]
[cplayer] Run command: define-section, flags=64, args=[name="window-controls", contents="mbtn_left script-binding osc/__keybinding11\n", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="window-controls", flags=""]
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-visibility=auto"]
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Run command: disable-section, flags=64, args=[name="input"]
[cplayer] Run command: disable-section, flags=64, args=[name="window-controls"]
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-margins=0.000000,0.000000,0.000000,0.000000"]
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Done loading scripts.
[global] config path: 'watch_later' -> '/root/.config/mpv/watch_later'
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook
[ytdl_hook] not a ytdl:// url
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-margins=0.000000,0.000000,0.000000,0.000000"]
[avdevice] Opening av://v4l2:/dev/video0
[avdevice] resize stream to 4096 bytes, drop 0 bytes
[cplayer] Set property: shared-script-properties -> 1
[osc] osc_init
[avdevice] Stream opened successfully.
[demux] Trying demuxers for level=request.
[demux] Trying demuxer: lavf (force-level: request)
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="append", value="osc-margins=0.000000,0.000000,0.000000,0.000000"]
[cplayer] Set property: shared-script-properties -> 1
[global] config path: 'fonts' -/-> '/root/.config/mpv/fonts'
[global] config path: 'fonts' -/-> '/root/.mpv/fonts'
[global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[osd/libass] ASS library version: 0x1701000 (runtime 0x1701000)
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[lavf] Found 'video4linux2,v4l2' at score=100 size=0 (forced).
[osd/libass] Shaper: FriBidi 1.0.10 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[global] config path: 'subfont.ttf' -/-> '/root/.config/mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/root/.mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[global] config path: 'fonts.conf' -/-> '/root/.config/mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/root/.mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[osd/libass] Setting up fonts...
[ffmpeg/demuxer] video4linux2,v4l2: fd:6 capabilities:84a00001
[lavf] avformat_open_input() failed
[cplayer] Opening failed or was aborted: av://v4l2:/dev/video0
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Running hook: ytdl_hook/on_load_fail
[ytdl_hook] full hook
[cplayer] Run command: define-section, flags=64, args=[name="input_osc", contents="", flags="default"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_osc", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] Run command: define-section, flags=64, args=[name="input_forced_osc", contents="", flags="force"]
[cplayer] Run command: enable-section, flags=64, args=[name="input_forced_osc", flags="allow-hide-cursor+allow-vo-dragging"]
[cplayer] finished playback, unrecognized file format (reason 4)
[cplayer] Failed to recognize file format.
[cplayer]
[cplayer] Exiting... (Errors when loading file)
[ytdl_hook] Exiting...
[cplayer] Run command: change-list, flags=64, args=[name="shared-script-properties", operation="remove", value="osc-margins"]
[cplayer] Set property: shared-script-properties -> 1
[stats] Exiting...
[console] Exiting...
[osc] Exiting...
KJ7LNW
(525 rep)
Mar 24, 2024, 10:13 PM
• Last activity: Mar 26, 2024, 08:06 PM
0
votes
1
answers
377
views
reduce audio quality in mpv
I have very limited data in a remote area and so I listen to youtube (and other video platforms) using ```mpv --no-video ```. Does anyone know how to lower the audio quality so that I can reduce my streaming data usage even more? (most of what i listen to is just talk). I tried adding ```profile=fas...
I have very limited data in a remote area and so I listen to youtube (and other video platforms) using
--no-video
.
Does anyone know how to lower the audio quality so that I can reduce my streaming
data usage even more? (most of what i listen to is just talk).
I tried adding =fast
in .conf
but mpv didn't recognize it. I also
searched through mpv
but couldn't find what I wanted.
I am using Linux Mint 21.2
UPDATE:
Using the accepted answer and searching mpv | grep ytdl
, I ended up with:
--no-video --ytdl-format=worstaudio/worst
This reduced data usage by almost half and as far as a podcast goes, there is little difference in listen-ablity.
bungee1980
(27 rep)
Mar 4, 2024, 09:32 PM
• Last activity: Mar 6, 2024, 10:22 AM
0
votes
2
answers
452
views
Can I play a playlist of rear and front dashcam videos in MPV?
I'm trying to play both front and rear footage from my dashcam at the same time as a playlist in `mpv`. Front and rear video files are in `F` and `R` directories. I can easily add all files from e.g. `F` directory to the playlist: mpv F/* I can also run a picture-in-picture overlay for a single pair...
I'm trying to play both front and rear footage from my dashcam at the same time as a playlist in
2nd overlay, plays rear view from the 1st one:
For now I'm using a script that runs
mpv
.
Front and rear video files are in F
and R
directories. I can easily add all files from e.g. F
directory to the playlist:
mpv F/*
I can also run a picture-in-picture overlay for a single pair of front/rear footage:
mpv $front_video --external-file=$rear_video --lavfi-complex='[vid2] scale=640x360 [small]; [vid1] [small] overlay [vo]'
I'm having trouble combining both, i.e. I want a playlist of picture-in-picture overlays. The issue is I always get the rear view from the first video:
mpv \
REC_200607-175943F.MOV --external-file=../R/REC_200607-175943R.MOV --lavfi-complex='[vid2] scale=640x360 [small]; [vid1] [small] overlay [vo]' \
GSR_200607-180444F.MOV --external-file=../R/GSR_200607-180444R.MOV --lavfi-complex='[vid2] scale=640x360 [small]; [vid1] [small] overlay [vo]' \
GSR_200607-180943F.MOV --external-file=../R/GSR_200607-180943R.MOV --lavfi-complex='[vid2] scale=640x360 [small]; [vid1] [small] overlay [vo]'
1st overlay, all fine:


mpv
for the next pair of videos as soon as the first one quits so I can watch all of them from start to finish but I miss the features like jumping to previous/next video, checking where in the playlist I am, setting a playback speed, volume, contrast, etc. Also, it's cumbersome to stop in the middle of playback because quitting one mpv
instance runs the next one:
#!/bin/sh
for front in $(ls -tr); do
rear=../R/${front/F./R.}
mpv $front --external-file=$rear --lavfi-complex='[vid2] scale=640x360 [small]; [vid1] [small] overlay [vo]'
done
Any suggestions?
cprn
(1035 rep)
Jun 8, 2020, 09:07 PM
• Last activity: Feb 3, 2024, 04:50 PM
1
votes
1
answers
3955
views
mpv subtitle font
I have looked in `mpv.conf` and in `input.conf` and don't see any setting for subtitle font. I see size but not font name. However I see that it must be a configurable value because I have mpv running on two different machines and see they are different from each other.
I have looked in
mpv.conf
and in input.conf
and don't see any setting for subtitle font. I see size but not font name.
However I see that it must be a configurable value because I have mpv running on two different machines and see they are different from each other.
Stephen Boston
(2526 rep)
Sep 26, 2022, 03:52 PM
• Last activity: Feb 1, 2024, 09:02 PM
1
votes
2
answers
1720
views
Play lyrics automatically with mpv
Mpv is not loading and playing lyrics files, even though they're in the same directory with the same name but different `.lrc` file extension. and I even have the following in my mpv.conf file ``` .conf autoload-files=yes sub-auto=fuzzy ```
Mpv is not loading and playing lyrics files, even though they're in the same directory with the same name but different
.lrc
file extension.
and I even have the following in my mpv.conf file
.conf
autoload-files=yes
sub-auto=fuzzy
Wis
(213 rep)
Apr 4, 2019, 05:08 AM
• Last activity: Jan 31, 2024, 11:40 AM
12
votes
3
answers
30507
views
mpv stepping through frames
When using `mpv` to step through frames (`.` for stepping forward and `,` for stepping backward), the forward stepping rate is much faster than the backward stepping rate. The forward rate is about the same as the video frame rate (60fps for the video in question, which is an mp4 file prepared from...
When using
mpv
to step through frames (.
for stepping forward and ,
for stepping backward), the forward stepping rate is much faster than the backward stepping rate. The forward rate is about the same as the video frame rate (60fps for the video in question, which is an mp4 file prepared from a set of png images using ffmpeg
with libx264
encoding) whereas the reverse stepping rate is about 1fps. Is there any way to control the stepping rates? Why would the forward/backward rates be so asymmetric? If an alternative video player is available for linux systems that supports variable (or at least equally fast) video frame stepping, please advise (mplayer
is not better than mpv
in this regard).
user001
(3808 rep)
Jan 21, 2017, 11:54 PM
• Last activity: Nov 6, 2023, 02:56 PM
0
votes
1
answers
95
views
ksh88 string substitution in alias | mpv streaming
**tl;dr** how can I substitute a string (i.e. a youtube/streaming url) in an alias such as `alias mpvyt='yt-dlp -o - | mpv - '` ? I live in a mezzanine studio using a M1 macbook for a workstation (writing/editing) and my old laptop with openbsd as a local server. I play music from that *obsd* server...
**tl;dr** how can I substitute a string (i.e. a youtube/streaming url) in an alias such as
alias mpvyt='yt-dlp -o - | mpv - '
?
I live in a mezzanine studio using a M1 macbook for a workstation (writing/editing) and my old laptop with openbsd as a local server. I play music from that *obsd* server upstairs, which thus fills the whole room down to my desktop through the plugged-in speakers. My hosted library plays fine with [mpd](https://openports.pl/path/audio/mpd) and [ncmpcpp](https://formulae.brew.sh/formula/ncmpcpp) , and I just figured out it's not so difficult to [use mpv to play streamed youtube videos](https://www.reddit.com/r/mpv/comments/opoorx/comment/j7exh1n/) , since firefox in [XQuartz](https://www.xquartz.org/) streaming from [xenocara](https://xenocara.org/) is way too slow anyhow.
I use a variety of different alias**\[1\]** as shortcuts to frequent commands, and [understand](http://sylvain.sab.free.fr/cestquoi/) [the basics of programming](http://sylvain.sab.free.fr/cestquoi/programmation/) but am an absolute beginner when it comes to [shell/ksh88 syntax](https://man.openbsd.org/ksh) . I would like to use a short command for streaming youtube videos from the obsd server which I connect to using ssh. The following : yt-dlp -o - | mpv - -force-seekable=yes
works well but **how can I do something like alias mpvyt='yt-dlp %s -o - | mpv -'
** so that I don't have to type the full command ?
I suppose it involves a **basic string substitution using the** **ksh88** **syntax** which I am clueless about ... **or** perhaps I need to go as “far” as to use **a little standalone shell script a.k.a snippet ?** To go further, a great bonus would be if I could stream playlists, as well as separate the video and audio streams so I can play the video on the workstation screen, I will look into the [mpv documentation](https://mpv.io/manual/) for this.
**\[1\]** (you may skip this irrelevant block of code, I just copy-pasted my terminal output to brag about my network and aliases)
Last login: Tue Oct 31 06:54:34 on ttys002
sylvain@sylvainmac ~ % more /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
#192.168.1.254 box
192.168.1.1 srv
#192.168.1.11 lap
192.168.1.21 mac
192.168.1.51 droid
sylvain@sylvainmac ~ % grep alias .zprofile
alias u='brew update && brew upgrade ; sudo port selfupdate && sudo port upgrade outdated' #update command
alias z='ncmpcpp'
alias srvsh='ssh sylvain@srv'
alias srvx='ssh -X sylvain@srv' #used from xquartz, deprecated
alias srvm='sshfs sylvain@srv: ~/srv'
alias sic='sic -n sylvainsab'
alias l='ls'
alias la='ls -a'
alias ll='ls -l'
alias lla='ls -la'
sylvain@sylvainmac ~ % srvsh
sylvain@srv password:
Last login: Tue Oct 31 06:56:06 2023 from 192.168.1.21
OpenBSD 7.4 (GENERIC.MP) #0: Sun Oct 22 12:13:42 MDT 2023
Welcome to OpenBSD: The proactively secure Unix-like operating system.
Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code. With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.
$grep alias .kshrc
alias l='ls -F'
alias ll='ls -l'
alias la='ls -a'
alias lla='ls -Al'
alias t='tmux attach'
alias z='ncmpcpp'
alias fxr='firefox-esr -P remote &' #used with xquartz, deprecated
alias n='doas umount /mnt'
alias u='doas pkg_add -Uu && doas syspatch && doas fw_update' #update command
alias macm='doas sshfs -o idmap=user,allow_other,uid=1000,gid=1000 sylvain@mac: ~/mac'
alias rmds='find . -iname *.DS_Store -exec rm {} \;'
alias mic_on='doas sysctl kern.audio.record=1'
alias mic_off='doas sysctl kern.audio.record=0'
alias cam_on='doas sysctl kern.video.record=1'
alias cam_off='doas sysctl kern.video.record=0'
alias ytdl='yt-dlp --prefer-free-formats -f bestvideo+bestaudio --audio-quality 0 -o "%(title)s-%(id)s.%(ext)s"'
$^D
Connection to srv closed.
sylvain@sylvainmac ~ %
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Opération terminée]
sylvansab
(109 rep)
Oct 31, 2023, 06:29 AM
• Last activity: Oct 31, 2023, 07:40 AM
1
votes
2
answers
607
views
how to figure out font color given in subtitle (srt) in mpv
For e.g. I have this sort of subtitle 1 00:01:55,201 --> 00:01:58,401 It's absurd going to school every day. The school's closed today. Now I'm unable to figure out the font color. Is there a way to get the color chart or give names or something that makes it clear what the color of the sentence is...
For e.g. I have this sort of subtitle
1
00:01:55,201 --> 00:01:58,401
It's absurd going to school
every day. The school's closed today.
Now I'm unable to figure out the font color. Is there a way to get the color chart or give names or something that makes it clear what the color of the sentence is ?
shirish
(12954 rep)
Dec 28, 2019, 11:19 PM
• Last activity: Oct 18, 2023, 08:18 AM
0
votes
1
answers
63
views
Efficiently Tracking and Updating configs (dotfiles) from Multiple GitHub Repositories
I'm tracking several GitHub repositories, from which I often fetch configuration files for tools like `mpv` and `hyprland`. Given that these repositories frequently receive updates, I'm seeking a more efficient process to pull the latest changes without manually inspecting each repository and mergin...
I'm tracking several GitHub repositories, from which I often fetch configuration files for tools like
mpv
and hyprland
. Given that these repositories frequently receive updates, I'm seeking a more efficient process to pull the latest changes without manually inspecting each repository and merging with my custom changes.
**Current Process**:
1. Subscribe to changes on these repositories.
2. Manually download the updated config files.
3. Compare old and new config files (figure out what thing i chaged in which config, which was changed by developer)
4. Resolve conflicts manually.
5. Repeat this cycle.
**Repositories** (for reference, there are many more):
-
-
-
-
-
This problem isn't new but i can't find any reference to this. Maybe i can't phrase it correctly.Does anyone have any strategies, scripts or tools help streamline this process? I'd like to be able to easily pull updates, see differences, and manage conflicts more efficiently.
Phoenix
(3 rep)
Oct 12, 2023, 01:07 AM
• Last activity: Oct 12, 2023, 03:37 AM
Showing page 1 of 20 total questions