mpv で動画再生する基本的な方法(Ubuntu Studio 22.04 LTS)
基本的な再生方法
mpv は、基本的にコマンドで再生することになる

プレイリストによる再生
シェルスクリプトで再生





マウス操作
キーボード操作
基本的な再生方法
mpv は、基本的にコマンドで再生することになる
- フルパスで
$ mpv /home/ユーザー/movies/aaa.mp4
- ファイルがユーザーフォルダの中にある場合は、~ を使って
$ mpv ~/movies/aaa.mp4
- フォルダ内のビデオを再生
$ mpv ~/movies
※「 movies 」フォルダ内のビデオファイルが順番に再生される(フォルダから再生する時は、ファイル名の先頭が日本語文字のファイルから再生が開始され、その後に先頭が英数字のファイルが再生されるようだ)
- Windows でファイル名やフォルダ名に空白を入れていて、そのファイルやフォルダをそのまま Linux に持ってきた場合は、空白が入っている名前を「 " 」(ダブルクォーテーション)で括る必要がある
- ターミナルでパスを記述する部分に、ファイルやフォルダをドラッグ&ドロップしてもよい

- 再生が始まると、ファイルに Artist や Comment などのタグがある場合、ターミナルに表示される
- GUI で mpv Media Player を起動し、ウィンドウ内にファイルやフォルダをドラッグ&ドロップしても再生出来る
プレイリストによる再生
- テキストファイルに、再生したいファイルのパスをフルパスで、1行に1ファイルずつ記述する
- ビデオファイルを右クリックして「場所をコピーする」をクリックすると、ファイルのパスがコピー出来るので、それをテキストファイルに貼り付けて改行、を繰り返せば良い
- ファイル名やフォルダ名の中に空白があっても、何故かプレイリスト上では「 " 」(ダブルクォーテーション)で括る必要が無い
- 以下のようなオプションをつけて、フルパスでプレイリストを指定する
$ mpv --playlist=/home/ユーザー/movies/AAA.txt
- GUI の mpv Media Player にプレイリストをドラッグ&ドロップしても再生出来ない
シェルスクリプトで再生
- テキストファイルに、例えば以下のように記述する
#!/bin/bashmpv --playlist=/home/ユーザー/movies/AAA.txt --autofit=1000
- 「 #!/bin/bash 」は、シェルスクリプトで必ず最初に記述するものと覚えておけばよいと思う
- 2行目は、上述のようなビデオを再生するコマンドを書く
- 「 --autofit=1000 」は、ビデオの再生サイズを横幅 1000 pixel にするオプションで、例えばSD ビデオを再生して画面が小さいと思う時などに、このオプションで再生サイズを指定できるので、SD ビデオばかりのプレイリストやフォルダの再生時に活用出来る
- このファイルを、例えば「 bbb.sh 」という名前で保存する
- 拡張子は「.sh 」でなくても構わないかもしれないが、「 .sh 」にしておいがほうがファイルマネージャなどによってシェルスクリプトとして認識されるので無難かも
- bbb.sh のプロパティを開き、「パーミッション」タブの「アクセス許可」欄の下の方にある、「実行可能」のチェックボックスをチェックし、「 OK 」を押す
- これで、bbb.sh をダブルクリックすれば、記述したコマンドが実行される

- こうして作成したシェルスクリプトファイルをフォルダにまとめて入れておく
- そのフォルダをデスクトップへドラッグする

- デスクトップでフォルダをドロップすると、メニューが表示されるので、「ここにリンク」をクリックする

- デスクトップにフォルダのシンボリックリンクが作成される
- 作成されたシンボリックリンクにマウスポインタを置くと、上向きの矢印が表示される

- 矢印をクリックすると、リンク元のフォルダの内容が表示される

- 表示されたシェルスクリプトをダブルクリックすれば、そこに記述されたビデオファイルの再生コマンドが実行される
- こうして、デスクトップのシンボリックリンクからプレイリストやフォルダ内のビデオファイルの再生が簡単に出来るようになる
マウス操作
- mpv.io のマニュアルから抜粋( https://mpv.io/manual/stable/#mouse-control )
Left double clickToggle fullscreen on/off.
Right clickToggle pause on/off.
Forward/Back buttonSkip to next/previous entry in playlist.
Wheel up/downSeek forward/backward 10 seconds.
Wheel left/rightDecrease/increase volume.
キーボード操作
- mpv.io のマニュアルから一部抜粋・整理( https://mpv.io/manual/stable/#keyboard-control )
動画の再生に関するものp / SPACEPause (pressing again unpauses).qStop playing and quit.QLike q, but store the current playback position. Playing the same file later will resume at the old playback position if possible.[ and ]Decrease/increase current playback speed by 10%.{ and }Halve/double current playback speed.BACKSPACEReset playback speed to normal.dActivate/deactivate deinterlacer.ACycle aspect ratio override.Ctrl hToggle hardware video decoding on/off.再生位置の前後移動に関するもの
. (ピリオド)Step forward. Pressing once will pause, every consecutive press will play one frame and then go into pause mode again., (カンマ)Step backward. Pressing once will pause, every consecutive press will play one frame in reverse and then go into pause mode again.LEFT and RIGHTSeek backward/forward 5 seconds. Shift+arrow does a 1 second exact seek (see --hr-seek).UP and DOWNSeek forward/backward 1 minute. Shift+arrow does a 5 second exact seek (see --hr-seek).PGUP and PGDWNSeek to the beginning of the previous/next chapter. In most cases, "previous" will actually go to the beginning of the current chapter; see --chapter-seek-threshold.Shift+PGUP and Shift+PGDWNSeek backward or forward by 10 minutes. (This used to be mapped to PGUP/PGDWN without Shift.)ループ再生に関するものlSet/clear A-B loop points. See ab-loop command for details.LToggle infinite looping.キーボードのマルチメディアキーに関するもの(The following keys are valid if you have a keyboard with multimedia keys.)PAUSEPause.STOPStop playing and quit.PREVIOUS and NEXTSeek backward/forward 1 minute.プレイリストに関するもの(※フォルダの再生時も使える)< and >Go backward/forward in the playlist.ENTERGo forward in the playlist.音量に関するもの/ and *Decrease/increase volume.9 and 0Decrease/increase volume.mMute sound.ウィンドウの配置、画面の大きさに関するものTToggle stay-on-top (see also --ontop).fToggle fullscreen (see also --fs).ESCExit fullscreen mode.Alt + and Alt -Combining Alt with the + or - keys changes video zoom.Alt+BACKSPACEReset the pan/zoom settings.
(The following keys are valid only when using a video output that supports the corresponding adjustment.)Alt+0 (and command+0 on macOS)Resize video window to half its original size.Alt+1 (and command+1 on macOS)Resize video window to its original size.Alt+2 (and command+2 on macOS)Resize video window to double its original size.command + f (macOS only)Toggle fullscreen (see also --fs).画質調整に関するもの(The following keys are valid only when using a video output that supports the corresponding adjustment.)1 and 2Adjust contrast.3 and 4Adjust brightness.5 and 6Adjust gamma.7 and 8Adjust saturation.画面上の表示に関するものdelCycle OSC visibility between never / auto (mouse-move) / alwayso (also P)Show progression bar, elapsed time and total duration on the OSD.OToggle OSD states between normal and playback time/duration.F8Show the playlist and the current position in it (useful only if a UI window is used, broken on the terminal).F9Show the list of audio and subtitle streams (useful only if a UI window is used, broken on the terminal).i and IShow/toggle an overlay displaying statistics about the currently playing file such as codec, framerate, number of dropped frames and so on. See STATS for more information.vToggle subtitle visibility.Shift+g and Shift+fAdjust subtitle font size by +/- 10%.r and RMove subtitles up/down. The t key does the same as R currently, but use is discouraged.スクリーンショットに関するものsTake a screenshot.STake a screenshot, without subtitles. (Whether this works depends on VO driver support.)Ctrl sTake a screenshot, as the window shows it (with subtitles, OSD, and scaled video).
※スクショの保存先は基本的にはユーザーディレクトリ( ~/ )になるようだが、上記のシェルスクリプトをまとめたフォルダからスクリプトを実行した場合は、スクリプトのあるフォルダに保存される





























