[ACCEPTED]-How do I extract video information from a H.264 .TS file?-analyzer

Accepted answer
Score: 10

You can run mediainfo (here) and parse its output.

mediainfo <filename> will 1 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                           : Main@L3.0
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                           : Main@L3.0
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
Score: 1

You should be able to use ffmpeg to get 9 good details of the encoded video. VLC will 8 also give you quite a bit of information 7 but may not all the information you need. You 6 can check for that as well. If you need 5 even more information, then you can extract 4 the video and audio elementary streams from 3 the TS file ( using bbdemux etc utilities 2 ) and then you can analyse the video stream 1 separately using Elecard Stream analyzer.

Vibgyor

Score: 1

For TS audio and video bitrate I wrote a 12 small utility.

It searches for PAT packet, then 11 extracts PMT PID, then looks up the PMT 10 packet and extracts the PID for video and 9 audio packets. AFter that I'm able to calculate 8 the relative proportion of audio and video 7 packets in the whole stream.

From the total 6 bitrate (obtained with other utilities (eg: size/duration)) then 5 it's a simple multiplication to get the 4 values..

Note: I don't analyze the whole 3 stream, only the first couple of megabytes.

I'm 2 still interested in any existing utilities 1 which can give me this info.

More Related questions