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.
MPEG transport stream (MPEG-TS, MTS) or simply transport stream (TS) is a standard digital container format for transmission and storage of audio, video, and Program and System Information Protocol (PSIP) data. It is used in broadcast systems such as DVB, ATSC and IPTV.
If you have a TS file on your computer, you can open it with a number of media players. VLC should be your first choice since it's completely free and can open these files on Mac, Windows, and Linux. MPEG Streamclip is another option, and the Movies & TV Windows app might work too.
ts file is just a container file. Encapsulated inside the . ts file you'll find an audio stream file and a video stream file. If the audio stream file is already in the format you need to use and that format happens to be AIFF, M1A or AC3, then you can just demux the file.
The video quality of MP4 and TS files are the same. The primary difference between TS and MP4 files is that TS files are flat while MP4 files have an index at the beginning of the MP4 file. Otherwise, the video bits inside the files are the same and therefore the video quality of TS, M2TS and MP4 files are the same.
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
You should be able to use ffmpeg to get good details of the encoded video. VLC will also give you quite a bit of information but may not all the information you need. You can check for that as well. If you need even more information, then you can extract the video and audio elementary streams from the TS file ( using bbdemux etc utilities ) and then you can analyse the video stream separately using Elecard Stream analyzer.
Vibgyor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With