はじめに
Jetson Linuxで動画ファイルに関連付けされているデフォルトのアプリケーションはTotemとなっています。ただし、動画ファイルによってはTotemでは下図のように再生できないことがあり不便です。
ここではJetson Linuxで使える動画再生GUIツールをいくつか試してみました。
動作環境
ハードウェア
- reComputer J4012(Jetson Orin NX 16GB)
ソフトウェア
- Jetson Linux 35.4.1(https://developer.nvidia.com/embedded/jetson-linux-r3541)
- mpv 0.32.0(https://mpv.io/)
動画再生ツール
ツール毎のNVDEC使用状況などを下表にまとめます。 今回、NVDEC使用状況はjetson_stats(https://github.com/rbonghi/jetson_stats)を使って確認しました。
動画再生ツール | NVDEC使用状況 | 再生補助GUIの有無 (シーク再生、停止など) |
---|---|---|
gst-launch-1.0 | 使用(NVIDIA製GStreamerエレメント使用時) | なし |
gst-play-1.0 | 使用 | なし |
nvgstplayer | 使用 | なし |
VLC | 未使用 | あり |
mpv | 未使用 | あり |
例えば、高解像度の動画ファイルの場合はNVDECが使えるツールを用いるなど用途によって使い分けるのがよさそうです。また、以降では/opt/nvidia/vpi2/samples/assets/dashcam.mp4
というサンプル動画ファイルを用います。
gst-launch-1.0
gst-launch-1.0 filesrc location=/opt/nvidia/vpi2/samples/assets/dashcam.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! 'video/x-raw(memory:NVMM)' ! nv3dsink
location
に再生したいファイルパスを指定します。また、上記コマンドはhttps://forums.developer.nvidia.com/t/failed-to-play-mp4-h-264/267226/3を参考にしています。
GStreamerエレメントを繋いで独自のパイプラインを作成できるため、後述のgst-play-1.0
、nvgstplayer
よりも自由度が高い方法になります(ただし、GStreamerの知識が必要です)。
gst-play-1.0
gst-play-1.0 /opt/nvidia/vpi2/samples/assets/dashcam.mp4
詳細なオプションはAppendixを参照ください。
nvgstplayer
nvgstplayer -i /opt/nvidia/vpi2/samples/assets/dashcam.mp4
詳細なオプションはAppendixを参照ください。
VLC
VLCをインストールします。
sudo apt install vlc
ただし、このままだと動画ファイルによっては再生することができません。https://forums.developer.nvidia.com/t/vlc-media-player-crashes/154612/4にあるように
sudo mv /usr/lib/aarch64-linux-gnu/vlc/plugins/codec/libomxil_plugin.so /usr/lib/aarch64-linux-gnu/vlc/plugins/codec/libomxil_plugin.so.old
というワークアラウンドを行うことでVLCでソフトウェアデコーダーが使われるようになり、再生することができます。
vlc /opt/nvidia/vpi2/samples/assets/dashcam.mp4
mpv
mpvをインストールします。
sudo apt install mpv
mpv /opt/nvidia/vpi2/samples/assets/dashcam.mp4
ファイルの関連付け
ここではmpvをデフォルトアプリケーションに割り当てます。Ubuntu設定画面「デフォルトのアプリ」から「ビデオ」のアプリケーションをmpvにします。
この設定を行うことでメディアファイルをダブルクリックするとmpvで再生されるようになります。
Appendix:各種ツールのオプション
gst-play-1.0
$ gst-play-1.0 --help
用法:
gst-play-1.0 [オプション…] FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...
ヘルプのオプション:
-h, --help ヘルプのオプションを表示する
--help-all ヘルプのオプションをすべて表示する
--help-gst GStreamer オプションを表示する
アプリケーションのオプション:
-v, --verbose Output status information and property notifications
--flags Control playback behaviour setting playbin 'flags' property
--version Print version information and exit
--videosink Video sink to use (default is autovideosink)
--audiosink Audio sink to use (default is autoaudiosink)
--gapless Enable gapless playback
--shuffle Shuffle playlist
--no-interactive Disable interactive control via the keyboard
--volume Volume
--playlist Playlist file containing input media files
-q, --quiet Do not print any output (apart from errors)
--use-playbin3 Use playbin3 pipeline(default varies depending on 'USE_PLAYBIN' env variable)
--wait-on-eos Keep showing the last frame on EOS until quit or playlist change command (gapless is ignored)
nvgstplayer
$ nvgstplayer --help
Usage:
nvgstplayer [OPTION?] Nvidia GStreamer Model Test
Help Options:
-?, --help Show help options
--help-all Show all help options
--help-gst Show GStreamer Options
Application Options:
--version Prints the version of Gstreamer used
-u, --urifile Path of the file containing the URIs
-i, --uri input URI
-e, --elemfile Element(s) (Properties) file
-x, --cxpr Command sequence expression
-n, --loop Number of times to play the media
-c, --audio-track If stream have multiple audio tracks, play stream with given track no
-v, --video-track If stream have multiple video tracks, play stream with given track no
-a, --start Start of the segment in media in seconds
-d, --duration Play duration of the segment in media in seconds
--no-sync Disable AV Sync
--disable-dpms Unconditionally Disable DPMS/ScreenBlanking during operation and re-enable upon exit
--stealth Operate in stealth mode, alive even when no media is playing
--bg Operate in background mode, keyboard input will be entirely ignored
--use-playbin Use Playbin
--no-audio Disable audio
--no-video Disable video
--disable-anative Disable native audio rendering
--disable-vnative Disable native video rendering
--use-buffering Use Buffering
-l, --low-percent Low threshold for buffering to start, in %
-j, --high-percent High threshold for buffering to finish, in %
--loop-forever Play the URI(s) in loop forever
-t, --max-size-time Max. amount of time in the queue (0=automatic)
-y, --max-size-bytes Max. amount of bytes in the queue (0=automatic)
-b, --max-size-buffers Max. amount of buffers in the queue (0=automatic)
--window-x X coordinate for player window (for non overlay rendering)
--window-y Y coordinate for player window (for non overlay rendering)
--window-width Window width (for non overlay rendering)
--window-height Window height (for non overlay rendering)
--disable-fullscreen Play video in non fullscreen mode (for nveglglessink)
-h, --drop-threshold-pct Permittable frames drop percentage, to be used with --stats (only for development purpose)
-k, --image-display-time Image display time in seconds
--show-tags shows tags (metadata), if available
--stats shows stream statistics, if enabled
--stats-file File to dump stream statistics, if enabled
--svd (=) chain for video decoding
--sad (=) chain for audio decoding
--svc (=) chain for video postprocessing
--sac (=) chain for audio postprocessing
--svs (=) chain for video rendering
--sas (=) chain for audio rendering
--shttp (=) chain for http source
--srtsp (=) chain for rtsp source
--sudp (=) chain for udp source
--sfsrc (=) chain for file source
Runtime Commands:
q quit the application
h print help
Up Key, ] goto next track
c restart current track
Down Key, [ goto previous track
spos query for position
sdur query for duration
s<val> seek to <val> position in seconds, eg "s5.120"
v<val> seek to <val> percent of the duration, eg "v54"
f<val> seek by <val> seconds, relative to current position eg "f23.901"
Left Key, < seek backwards by 10 seconds
Right Key, > seek forward by 10 seconds
p pause playback
r start/resume the playback
z stop the playback
i:<val> enter a single URI