See What Is Inside a Video File via SSH: mediainfo
Before you download or stream a video, you may want to know what it really contains: the resolution, the video format (H.264, H.265, AV1), HDR, the audio tracks and their languages, the subtitles. mediainfo and ffprobe tell you in a second, right on your App Hosting service. Both are installed on our App Hosting services; the steps were tested on our demo service.
Connect over SSH first: SSH how to get connected.
1. The Full Report
cd ~/downloads/"Folder" mediainfo "Movie.mkv"
The report has a block for the file (General) and one per track (Video, Audio, Text for subtitles). Our test video:
General Format : MPEG-4 Duration : 9 min 56 s Overall bit rate : 830 kb/s Video Format : AVC Width : 640 pixels Height : 360 pixels Frame rate : 24.000 FPS Audio Format : AAC LC Channel(s) : 2 channels
What the important lines mean:
- Video → Format:
AVCis H.264,HEVCis H.265,AV1is AV1. Older TVs and some players cannot play HEVC or AV1, so a media server has to convert them while you watch. - Width and Height: 1920 × 1080 is Full HD, 3840 × 2160 is 4K.
- HDR format in the Video block, if present:
Dolby Vision,SMPTE ST 2086(HDR10) and so on. Without an HDR screen, HDR videos look pale. - Audio blocks: one per audio track, with Language, Format (AAC, AC-3, E-AC-3, DTS, TrueHD) and Channel(s) (2 = stereo, 6 = 5.1).
- Text blocks: subtitles, with their language and format.
2. Short Answers
Length and size, or just the picture, in one line:
mediainfo --Inform="General;%Duration/String3% %FileSize/String4%" "Movie.mkv" mediainfo --Inform="Video;%Format% %Width%x%Height% %FrameRate% fps" "Movie.mkv"
Our test video: 00:09:56.504 59.01 MiB and AVC 640x360 24.000 fps.
All tracks of a file, one per line, with ffprobe:
ffprobe -v error -show_entries stream=index,codec_type,codec_name:stream_tags=language -of compact=p=0 "Movie.mkv"
index=0|codec_name=h264|codec_type=video|tag:language=und index=1|codec_name=aac|codec_type=audio|tag:language=und
und means that no language is set for the track.
3. Many Files at Once
The resolution and format of every MKV and MP4 file in a folder:
for f in *.mkv *.mp4; do [ -e "$f" ] && echo "$f: $(mediainfo --Inform='Video;%Format% %Width%x%Height%' "$f")"; done
A file that mediainfo cannot read, or that shows no Video block, is often incomplete or damaged: check that its torrent is complete, or recheck it in your torrent client.