VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Hi. I am looking for guidance or suggestions on how to go about this.

    I have a tool that reads in the x264 and x265 parameters from the encoded files. However, as I just realized, it is only successful at reading raw files, thus, video.hm10 or video.h264, video.h265, etc., but it will not read the info correctly when inside an mkv container.

    What is the method used to do this correctly? or is it a parser or something that I need to update in my "raw" routine. Thanks for any ideas.
    Last edited by vhelp; 24th Dec 2016 at 10:22.
    Quote Quote  
  2. Out of curiosity: What do you use to read the h.265 parameters?

    About the problem, seems like there are only two ways:
    a. extract (a part of) the file and extract the infos from that part
    or
    b. add the functionality to recognize mkv and extract the video stream from mkv files to your tool

    If your tool accepts a stream as input you could even extract the stream with mkvextract and pipe the output to your tool.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Out of curiosity: What do you use to read the h.265 parameters?
    I am reading the raw stream directly through code, then I format it for vertical viewing. Reading a long list of params can be messy looking. The idea about vertical viewing came to me while working in various database apps that I was writing for ms access databases.

    So, is the video file in some compressed form in an mkv file ? I thought it might be "pushed" down in the container and that all I have to do is search for the special code sequence and read the info from that point on. I have not looked at the mkv container yet. I am assuming that some important info about the actual video is being compressed somehow. But I guess the only way to know for sure is to trial and error the routine that reads the info and re-aline starting point, assuming that the videos are always in the same place, otherwise, I probably will not be able to read the info from the mkv file.
    Quote Quote  
  4. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    I just may be in luck. After examining a few mkv files through a hex program (I used virtualdub's), only the start position has moved, I think. I will have to reset my routine to first test/determine the file type for Raw or MKV container (via file extension: should be enough) and update the code to make the starting position adjustments). Hopefully, the position will not vary too deeply.

    EDIT: reading encoder parameters will only be applicable to x264 and x265 encoders. QSV and other hardware encoders do not write their parameters in the archive file, so it will not work for those files, only x264/x265.
    Last edited by vhelp; 18th Dec 2016 at 11:59.
    Quote Quote  
  5. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Update, and success!! I got it working. As long as the encoded videos are made through x264 or x265 the utility will extract the SEI encoding parameters from the Raw and MKV video file.
    Quote Quote  
  6. It would be easier and less error prone to just use MediaInfo CLI:
    MediaInfo.exe --Inform="Video;%Encoded_Library% %Encoded_Library_Settings%" "input.mkv"
    Quote Quote  
  7. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    It would be easier and less error prone to just use MediaInfo CLI:
    MediaInfo.exe --Inform="Video;%Encoded_Library% %Encoded_Library_Settings%" "input.mkv"
    Thanks for the advise, but I am writing a custom app. And mediainfo.dll would be required, which I don't want to have to keep track of, let alone, to add to the package. I'm trying to do all these in one custom unique app and not use any shared resources if at all possible. So far so good.
    Quote Quote  
  8. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Is there a preferred method to determining what file you have in order to proceed with it ?

    There are various containers, such as mkv, mpeg, ts, mp4, mov. And each have their own specific way of prepping their video into the container. What I am thinking of, is that I need to organize my routine and do some preliminary steps first and then proceed to obtain the info I am after. So I'm thinking that there must be some standard way (that everyone follows?) to obtain such certain pieces of information from any raw or container source. And if possible, I would like to follow that same standard approach and build it into my app.

    You see, I had initially got it working for mkv files but then ran into some encoded videos that my (decoder to reach sei params) routine did not work, though in post # 5, above, it appeared to work until I ran into some files where it did not work. So, something is changing in the way the video are being processed for some files.

    I would like to assume that people are encoding with either x264.exe or x265.exe cli's. But its possible that at some point they may require to transcode or mux them, using other tools like ffmpeg or mb4box, for instance. And as a result, these apps may change the position for where I can locate the info I'm after. So I need to be able to adapt to the same containers no matter what tool fudges with the sei parameters.

    Does anyone here have any advise as to how to go about it for these containers ?
    Quote Quote  
  9. There is a standard for each container and format, there is not one standard for them all. (which is why reading just the latest specification isn't often enough)
    A lot of container formats are similar, mpeg-based video formats and containers are all similar,....


    Regarding containers: Read the specification. If there are multiple versions of the specification be aware that you can encounter all of them.

    -> Yes, writing a parser for lots of containers and their content is a lot of work, which is why people like to use libraries like libav&co.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!