GNU/Linux >> Znalost Linux >  >> Linux

Jak načíst informace o video souboru z příkazového řádku pod Linuxem?

Zkuste mediainfo. Na příkazovém řádku napište mediainfo input.mkv . Pro podrobnější informace o videu mediainfo --fullscan input.mkv .

Příklad výstupu:

General
Unique ID                                : 239093944660469735839645243666869007606 (0xB3DFD199E22F0E7CBAE1FE52206834F6)
Complete name                            : input.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 39.6 MiB
Duration                                 : 20s 288ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 16.4 Mbps
Movie name                               : My best movie
Encoded date                             : UTC 2012-11-10 16:42:02
Writing application                      : mkvmerge v5.8.0 ('No Sleep / Pillow') built on Sep  2 2012 15:37:04
Writing library                          : libebml v1.2.3 + libmatroska v1.3.0
Produzent                                : ??? ???????
Thanks to                                : Bruce Davey
Lead performer                           : Rudy Youngblood
Remixed by                               : ©????

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
MultiView_Count                          : 2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=2, N=13
Muxing mode                              : Header stripping
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 20s 280ms
Bit rate mode                            : Variable
Bit rate                                 : 15.8 Mbps
Maximum bit rate                         : 16.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 0.304
Stream size                              : 38.2 MiB (96%)
Title                                    : Sony Hardware Video H.264 Encoder
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Muxing mode                              : Header stripping
Codec ID                                 : A_AC3
Duration                                 : 20s 288ms
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : -80ms
Stream size                              : 634 KiB (2%)
Title                                    : Sony Hardware Audio AC3 Encoder
Language                                 : Russian
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : The same subtitle format used on BDs/HD-DVDs
Title                                    : Sony Hardware PGS Encoder
Language                                 : English
Default                                  : Yes
Forced                                   : No

ffprobe

Pod Ubuntu:

sudo apt install ffmpeg
ffprobe a.mp4

Chcete-li získat informace o formátu, streamech atd., spusťte:

ffprobe -v error -show_format -show_streams a.mp4

[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/50
codec_tag_string=avc1
codec_tag=0x31637661
width=320
height=240
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=13
color_range=N/A
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
timecode=N/A
refs=4
is_avc=1
nal_length_size=4
id=N/A
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/12800
start_pts=0
start_time=0.000000
duration_ts=384000
duration=30.000000
bit_rate=34761
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=750
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=-1024
start_time=-0.023220
duration_ts=1324024
duration=30.023220
bit_rate=56517
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1293
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
TAG:language=und
TAG:handler_name=SoundHandler
[/STREAM]
[FORMAT]
filename=input.mp4
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=-0.023220
duration=30.024000
size=368644
bit_rate=98226
probe_score=100
TAG:major_brand=isom
TAG:minor_version=512
TAG:compatible_brands=isomiso2avc1mp41
TAG:title=FFprobe Tips
TAG:encoder=Lavf56.15.101
[/FORMAT]

Nebo můžete získat jen vybraný záznam např. size , s:

ffprobe -v error -show_entries format=size -of default=noprint_wrappers=1:nokey=1 input.mp4

Můžete také vystupovat jako JSON nebo CSV. Další informace o ffprobe.

ExifTool

Pod Ubuntu:

sudo apt install libimage-exiftool-perl
exiftool a.mp4

Ukázkový výstup:

ExifTool Version Number         : 10.00
File Name                       : lego.mp4
Directory                       : .
File Size                       : 375 kB
File Modification Date/Time     : 2016:02:03 17:18:15+01:00
File Access Date/Time           : 2016:02:03 17:18:49+01:00
File Inode Change Date/Time     : 2016:02:03 17:18:49+01:00
File Permissions                : rw-rw-r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.0
Compatible Brands               : mp42, isom, avc1
Movie Data Size                 : 379872
Movie Data Offset               : 168
Movie Header Version            : 0
Create Date                     : 2010:03:20 21:29:11
Modify Date                     : 2010:03:20 21:29:12
Time Scale                      : 90000
Duration                        : 5.57 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 2010:03:20 21:29:11
Track Modify Date               : 2010:03:20 21:29:12
Track ID                        : 1
Track Duration                  : 5.53 s
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 560
Image Height                    : 320
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 560
Source Image Height             : 320
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : JVT/AVC Coding
Bit Depth                       : 24
Color Representation            : nclc 1 1 1
Video Frame Rate                : 30
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2010:03:20 21:29:11
Media Modify Date               : 2010:03:20 21:29:12
Media Time Scale                : 48000
Media Duration                  : 5.57 s
Media Language Code             : eng
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 1
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Track 2 Name                    : Stereo
Handler Type                    : Metadata
Encoder                         : HandBrake 0.9.4 2009112300
Avg Bitrate                     : 546 kbps
Image Size                      : 560x320
Megapixels                      : 0.179
Rotation                        : 0

Viz také:https://askubuntu.com/questions/249828/command-to-see-media-file-info-in-terminal

Testováno na Ubuntu 18.10.


Můžete použít mplayer:

mplayer -vo null -ao null -frames 0 -identify videofile.mp4

Výstup:

MPlayer 1.1-4.2.1 (C) 2000-2012 MPlayer Team
Can't init Apple Remote.

Playing vid.mp4.
libavformat version 54.6.101 (internal)
libavformat file format detected.
ID_VIDEO_ID=0
[lavf] stream 0: video (h264), -vid 0
ID_AUDIO_ID=0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  480x360  24bpp  29.970 fps  700.7 kbps (85.5 kbyte/s)
Clip info:
 major_brand: qt
ID_CLIP_INFO_NAME0=major_brand
ID_CLIP_INFO_VALUE0=qt
 minor_version: 0
ID_CLIP_INFO_NAME1=minor_version
ID_CLIP_INFO_VALUE1=0
 compatible_brands: qt
ID_CLIP_INFO_NAME2=compatible_brands
ID_CLIP_INFO_VALUE2=qt
 creation_time: 2011-03-03 15:42:30
ID_CLIP_INFO_NAME3=creation_time
ID_CLIP_INFO_VALUE3=2011-03-03 15:42:30
 encoder: 4.2.1
ID_CLIP_INFO_NAME4=encoder
ID_CLIP_INFO_VALUE4=4.2.1
 encoder-eng: 4.2.1
ID_CLIP_INFO_NAME5=encoder-eng
ID_CLIP_INFO_VALUE5=4.2.1
 date: 2011-03-03T10:42:30-0500
ID_CLIP_INFO_NAME6=date
ID_CLIP_INFO_VALUE6=2011-03-03T10:42:30-0500
 date-eng: 2011-03-03T10:42:30-0500
ID_CLIP_INFO_NAME7=date-eng
ID_CLIP_INFO_VALUE7=2011-03-03T10:42:30-0500
ID_CLIP_INFO_N=8
Load subtitles in ./
ID_FILENAME=vid.mp4
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=700712
ID_VIDEO_WIDTH=480
ID_VIDEO_HEIGHT=360
ID_VIDEO_FPS=29.970
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=MP4A
ID_AUDIO_BITRATE=63600
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=1
ID_START_TIME=0.00
ID_LENGTH=3.83
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.23.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 63.6 kbit/9.01% (ratio: 7950->88200)
ID_AUDIO_BITRATE=63600
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=1
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [null] 44100Hz 1ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=ffaac
Starting playback...


Exiting... (End of file)
ID_EXIT=EOF

Linux
  1. Jak nainstalovat software z příkazového řádku Linuxu

  2. Jak mohu získat datový tok videa z příkazového řádku v Linuxu?

  3. Příkaz Linux pro načtení rozsahu bajtů ze souboru

  1. Jak extrahovat soubor tar.gz v Linuxu pomocí příkazového řádku

  2. Jak odstranit soubory a adresáře v Linuxu z příkazového řádku

  3. Jak rozdělit a kombinovat soubory z příkazového řádku v Linuxu

  1. Jak používat příkaz tar pod Linuxem

  2. Jak mohu získat rozlišení (šířku a výšku) pro video soubor z příkazového řádku linuxu?

  3. Jak nahradit soubor v jar příkazovým řádkem v linuxu?