#427 Show total video time of H.264 Elementary Streams

More_attribute
open-accepted
4
2014-01-29
2014-01-20
Michal
No

Hello,

I am missing very important info about H.264 Elementary streams. I need get information about total video time. I am not sure if it is possible but guess so because if I try open the elementary stream in latest MPC-HC it show me correct total time. Yes of course I cant seek in the file in MPC-HC but I dont need it. Just need to get total video time by MediaInfo.
Here is small sample h.264 elementary stream produced by VideoReDo. If you will need more I can provide next from different TV channels.

http://www.sendspace.com/file/xdwnmx

Thanks

1 Attachments

Discussion

  • With CLI (command line interface):
    mediainfo --ParseSpeed=1 "test H.264"

    Video
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.0
    Format settings, CABAC : Yes
    Format settings, ReFrames : 2 frames
    Format settings, GOP : M=3, N=12
    Duration : 960ms
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    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
    Stream size : 8.95 MiB (100%)


    It is impossible to get the duration of a VBR raw stream without parsing the whole file, this is the reason it is not available by default and user must configure MediaInfo for forcing full parsing.

    Available with DLL and CLI. Do you want it with GUI?

    Note: the result is buggy, I get the correct count of frames ("mediainfo -f" provides the frame count) of 241, but corresponding duration is wrong (should be ~9640 ms), it is a bug, I need to dig in it.

     
    • status: open --> pending
     
  • Michal
    Michal
    2014-01-20

    Hello,

    yes you are right about the cli and dll. I didnt know it. I am satisfied with CLI+DLL I dont need it in GUI. But the fact is that the duration is calculated wrong.

    I see another big problem in my point of view. The calculation of the duration takes too much time. If I have for example about one hour stream it takes few minutes. But I need get the information about total time OR frames very quickly because I use this information to calculate how much % of the stream has been indexed. I use DGDecNV for indexing.

    I think there must be some quicker way how to get duration OR total count of frames of any elementary streams even if it is VBR. Or how could be MPC-HC able show the correct total time so quickly?? Maybe it read from the header of the stream?

    mediainfo –f doesnt show me in the full output any information about frames count. Could you be more specific how did you get it (241) ?

     
  • But the fact is that the duration is calculated wrong.

    Please fill a bug report (I would like to separate well each issue, the wrong computing is a different issue)

    The calculation of the duration takes too much time.

    I already answer that: it is not possible with VBR raw streams, because there is no index and it is VBR, all changes every seconds. This is the reason the whole file must be parsed. No tool can do better because it is a design issue of (actually, it is wanted by) the format you are using.

    Edit: I see that your example has the HRD (Hypothetical Reference Decoder) cbr_flag set, with a bit rate (7,744,000 bps), so the stream can be detected as CBR and the duration could be estimated in that case (and only in that case: if you have a completely VBR stream, without the cbr_flag set, I don't get the bit rate information). The estimated duration is a bit less precise, I get ~9695 ms. Is it useful for you to get such estimated duration?

    Or how could be MPC-HC able show the correct total time so quickly??

    VLC or MPC-HC sometimes estimate a lot the duration, and I already saw huge difference between duration from VLC and real duration. Anyway, for your file, they may do that from the HRD bit_rate (estimation).
    I don't see how they could do if the stream is fully VBR.

    mediainfo –f doesnt show me in the full output any information about frames count. Could you be more specific how did you get it (241) ?

    MediaInfo.exe --ParseSpeed=1 -f test.h264
    General
    (...)

    Video
    (...)
    Frame count : 241
    (...)

     
  • Michal
    Michal
    2014-01-21

    I would be satisfied even with estimation of duration. I dont need exact time. So how could I calculate/guess it using mediainfo tool? How do you think to calculate it using HRD bit rate? If I have for example bit rate (7,744,000 bps) how could I estimate the duration?

     
  • Michal
    Michal
    2014-01-23

    So will be possible to add some internal variable "Estimated total time" based on HRD (Hypothetical Reference Decoder) cbr_flag ?

     
  • Yes. I update the ticket.

     
    • status: pending --> open-accepted
    • Priority: 1 --> 4
     
  • Accepted.

    Warning: non-paid feature request are set to low priority, I don't know when I have time to handle it.
    If you desire to accelerate the development, don't hesitate to contact me for a quotation.