Is there any good linux/unix tool to get the properties of an H264 .TS file?
I need the duration, video resolution and bitrate, fps, audio resolution and bitrate.
I tried mplayer -vo null -ao null -frames 0 -identify _file_
, but it reports wrong video width and height, and also reports the file length (duration) as 0.00.
You can run mediainfo (here) and parse its output.
mediainfo <filename>
will give you this kind of information:
General
ID : 2 (0x2)
Format : MPEG-TS
File size : 915 MiB
Duration : 8mn 31s
Start time : UTC 2009-06-09 14:15:57
End time : UTC 2009-06-09 14:24:12
Overall bit rate : 15.0 Mbps
Video #1
ID : 256 (0x100)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : 27
Duration : 8mn 31s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : MBAFF
Scan order : Top Field First
Color primaries : BT.470-6 System B, BT.470-6 System G, BT.601-6 625, BT.1358 625, BT.1700 625 PAL, BT.1700 625 SECAM
Transfer characteristics : BT.470-6 System B, BT.470-6 System G
Matrix coefficients : BT.470-6 System B, BT.470-6 System G, BT.601-6 625, BT.1358 625, BT.1700 625 PAL, BT.1700 625 SECAM, IEC 61966-2-4 601
Video #2
ID : 1001 (0x3E9)
Menu ID : 3 (0x3)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=3, N=24
Codec ID : 27
Duration : 8mn 30s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : MBAFF
Color primaries : BT.470-6 System B, BT.470-6 System G, BT.601-6 625, BT.1358 625, BT.1700 625 PAL, BT.1700 625 SECAM
Transfer characteristics : BT.470-6 System B, BT.470-6 System G
Matrix coefficients : BT.470-6 System B, BT.470-6 System G, BT.601-6 625, BT.1358 625, BT.1700 625 PAL, BT.1700 625 SECAM, IEC 61966-2-4 601
Audio #1
ID : 258 (0x102)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Mode : Joint stereo
Mode extension : Intensity Stereo + MS Stereo
Codec ID : 3
Duration : 8mn 31s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 11.7 MiB (1%)
Audio #2
ID : 1002 (0x3EA)
Menu ID : 3 (0x3)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 3
Duration : 8mn 31s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : 7s 978ms
Stream size : 11.7 MiB (1%)
Menu #1
ID : 257 (0x101)
Menu ID : 1 (0x1)
Duration : 8mn 31s
List : 256 (0x100) (AVC) / 258 (0x102) (MPEG Audio)
Service name : vv
Service type : digital television
Menu #2
ID : 1000 (0x3E8)
Menu ID : 3 (0x3)
Duration : 8mn 31s
List : 1001 (0x3E9) (AVC) / 1002 (0x3EA) (MPEG Audio)
Service name : Lenni
Service type : digital television