VideoHelp Forum




+ Reply to Thread
Results 1 to 18 of 18
  1. Hi, I'm making a program to recode my videos.

    How can I extract information such as bitrate, frame size, etc. from the command line (Windows)?
    Quote Quote  
  2. mediainfo, ffmpeg/ffprobe,...
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  3. thanks, i will try!
    Quote Quote  
  4. I'm having difficulty extracting the information because the list with mediainfo is very long.

    I opened a thread where we can continue.

    https://forum.videohelp.com/threads/412288-Method-to-batch-rencode-of-video-library
    Quote Quote  
  5. You can restrict the information mediainfo reports
    for example, you could call it with:
    Code:
    --Inform=Video;%ScanType/String%%%ScanOrder/String%%%PixelAspectRatio%%%Standard%%%Width%%%Height%%%FrameRate%"
    to get some basic information about the video.
    call it with:
    Code:
    mediainfo --Info-Parameters
    to see that information it can show for different streams&co,....
    => read the documentation and adjust the call so that you get the info you want and you get something that can be easily parsed.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  6. I tried to see the command Help but it seems incomplete.

    maybe I'm not capable

    The Help with the "inform" parameter does not seem to be there and your command seems not to work.

    Code:
    C:\Users\fra\Downloads\MediaInfo_CLI_23.10_Windows_x64>mediainfo -h
    MediaInfo Command line,
    MediaInfoLib - v23.10
    Usage: "mediainfo [-Options...] FileName1 [Filename2...]"
    
    Options:
    --Help, -h
                        Display this help and exit
    --Help-Output
                        Display help for Output= option
    --Help-AnOption
                        Display help for "AnOption"
    --Version
                        Display MediaInfo version and exit
    
    --Full, -f
                        Full information Display (all internal tags)
    --Output=HTML
                        Full information Display with HTML tags
    --Output=XML
                        Full information Display with XML tags
    --Output=OLDXML
                        Full information Display with XML tags using the older
                        MediaInfo schema
    --Output=JSON
                        Full information Display using JSON
    --Output=EBUCore
                        Full information Display with EBUCore compliant XML tags
    --Output=EBUCore_JSON
                        Full information Display with EBUCore 1.8 compliant JSON
    --Output=PBCore
                        Full information Display with PBCore compliant XML tags
    --Output=PBCore2
                        Full information Display with PBCore 2.0 compliant XML tags
    --AcquisitionDataOutputMode=segmentParameter
                        Display Acquisition Data by segment then parameter (EBUCore
                        and NISO Z39.87 outputs)
    --AcquisitionDataOutputMode=parameterSegment
                        Display Acquisition Data by parameter then segment (EBUCore
                        and NISO Z39.87 outputs)
    --ExternalMetadata=...
                        Add external metadata to the output (EBUCore output)
    --ExternalMetadataConfig=...
                        Output template for external metadata (EBUCore output)
    --Info-Parameters
                        Display list of Inform= parameters
    
    --Language=raw
                        Display non-translated unique identifiers (internal text)
    --Details=1
                        Display mediatrace info
    --inform_version=1
                        Add MediaInfoLib version to the text output
    --inform_timestamp=1
                        Add report creation timestamp to the text output
    --File_TestContinuousFileNames=0
                        Disable image sequence detection
    --LogFile=...
                        Save the output in the specified file
    --BOM
                        Byte order mark for UTF-8 output
    
    --Ssl_CertificateFileName=...
                        File name of the SSL certificate.
                        The default format is "PEM" and can be changed
                        with --Ssl_CertificateFormat.
    --Ssl_CertificateFormat=...
                        File format of the SSL certificate.
                        Supported formats are "PEM" and "DER"
    --Ssl_PrivateKeyFileName=...
                        File name of the SSL private key.
                        The default format is "PEM" and can be changed
                        with --Ssl_PrivateKeyFormat.
                        Note: private key with a password is not supported.
    --Ssl_PrivateKeyFormat=...
                        File format of the SSL private key.
                        Supported formats are "PEM" and "DER"
    --Ssl_CertificateAuthorityFileName=...
                        File name of the SSL certificate authorities
                        to verify the peer with.
    --Ssl_CertificateAuthorityPath=...
                        Path of the SSL certificate authorities
                        to verify the peer with.
    --Ssl_CertificateRevocationListFileName=...
                        File name of the SSL certificate revocation list.
                        The format is "PEM"
    --Ssl_IgnoreSecurity=...
                        Does not verify the authenticity of the peer's certificate
                        Use it at your own risks
    --Ssh_PublicKeyFileName=...
                        File name of the SSH private key.
                        Default is $HOME/.ssh/id_rsa.pub or $HOME/.ssh/id_dsa.pub
                        if the HOME environment variable is set, and just
                        "id_rsa.pub" or "id_dsa.pub" in the current directory
                        if HOME is not set.
                        Note: you need to set both public and private key.
    --Ssh_PrivateKeyFileName=...
                        File name of the SSH private key.
                        Default is $HOME/.ssh/id_rsa or $HOME/.ssh/id_dsa
                        if the HOME environment variable is set, and just
                        "id_rsa" or "id_dsa" in the current directory
                        if HOME is not set.
                        Note: you need to set both public and private key.
                        Note: private key with a password is not supported.
    --Ssh_KnownHostsFileName=...
                        File name of the known hosts
                        The format is the OpenSSH file format (libssh2)
                        Default is $HOME/.ssh/known_hosts
                        if the HOME environment variable is set, and just
                        "known_hosts" in the current directory
                        if HOME is not set.
    --Ssh_IgnoreSecurity
                        Does not verify the authenticity of the peer
                        (you don't need to accept the key with ssh first)
                        Use it at your own risks
    
    C:\Users\fra\Downloads\MediaInfo_CLI_23.10_Windows_x64>
    Sorry it's a stupid thing but I don't do it ...
    Quote Quote  
  7. Calling
    Code:
    mediainfo --Info-Parameters
    Outputs the following for me the data in "mediainfo_infoparameters.txt".

    Calling:
    Code:
    mediainfo --Inform=Video;%ScanType/String%%%ScanOrder/String%%%PixelAspectRatio%%%Standard%%%Width%%%Height%%%FrameRate% "g:\TestClips&Co\test.avi"
    outputs
    Code:
    Progressive%%1.000%%640%352%25.000
    for me which containes the all the asked parameters.
    "Video ScanType/String" is Progressive
    "Video ScanOrder/String": is, as expected, empty, since the source is progressive
    "Video PixelAspectRatio": is 1.000
    "Video Standard": is, as expected, empty, since the source isn't NTSC or PAL from a DVD or similar
    "Video Width" is 640
    "Video Height" is 352
    "Video FrameRate" is 25.000
    using
    [code]mediainfo --full "g:\TestClips&Co\test.avi"[/quote]
    would give:
    Code:
    General
    Count                                    : 349
    Count of stream of this kind             : 1
    Kind of stream                           : General
    Kind of stream                           : General
    Stream identifier                        : 0
    Count of video streams                   : 1
    Count of audio streams                   : 1
    Video_Format_List                        : MPEG-4 Visual
    Video_Format_WithHint_List               : MPEG-4 Visual (XviD)
    Codecs Video                             : MPEG-4 Visual
    Audio_Format_List                        : MPEG Audio
    Audio_Format_WithHint_List               : MPEG Audio (MP3)
    Audio codecs                             : MPEG Audio
    Audio_Language_List                      : Undefined
    Audio_Channels_Total                     : 2
    Complete name                            : g:\TestClips&Co\test.avi
    Folder name                              : g:\TestClips&Co
    File name extension                      : test.avi
    File name                                : test
    File extension                           : avi
    Format                                   : AVI
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format/Extensions usually used           : avi
    Commercial name                          : AVI
    Format settings                          : BitmapInfoHeader / WaveFormatEx
    Internet media type                      : video/vnd.avi
    Interleaved                              : No
    File size                                : 1846430
    File size                                : 1.76 MiB
    File size                                : 2 MiB
    File size                                : 1.8 MiB
    File size                                : 1.76 MiB
    File size                                : 1.761 MiB
    Duration                                 : 17160
    Duration                                 : 17 s 160 ms
    Duration                                 : 17 s 160 ms
    Duration                                 : 17 s 160 ms
    Duration                                 : 00:00:17.160
    Duration                                 : 00:00:17:04
    Duration                                 : 00:00:17.160 (00:00:17:04)
    Overall bit rate mode                    : VBR
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 860807
    Overall bit rate                         : 861 kb/s
    Frame rate                               : 25.000
    Frame rate                               : 25.000 FPS
    Frame count                              : 429
    Stream size                              : 38252
    Stream size                              : 37.4 KiB (2%)
    Stream size                              : 37 KiB
    Stream size                              : 37 KiB
    Stream size                              : 37.4 KiB
    Stream size                              : 37.36 KiB
    Stream size                              : 37.4 KiB (2%)
    Proportion of this stream                : 0.02072
    Title                                    : Encoding TestClip
    Movie name                               : Encoding TestClip
    Director                                 : AutorTest
    Genre                                    : Documentary / Drama
    Subject                                  : downfall of Hitler 
    Keywords                                 : Hitler
    Law rating                               : Unrated
    Recorded date                            : Heute
    File creation date                       : 2020-06-05 16:47:58.109 UTC
    File creation date (local)               : 2020-06-05 17:47:58.109
    File last modification date              : 2020-06-05 16:47:58.397 UTC
    File last modification date (local)      : 2020-06-05 17:47:58.397
    Writing application                      : VirtualDub build 29393/releaseNandub v1.0rc2
    Writing application                      : VirtualDub build 29393/releaseNandub v1.0rc2
    Original source form/Name                : Movie
    Copyright                                : CopyrightTest
    Comment                                  : Kleiner Testclip den ich zum Testen verwende
    
    Video
    Count                                    : 381
    Count of stream of this kind             : 1
    Kind of stream                           : Video
    Kind of stream                           : Video
    Stream identifier                        : 0
    StreamOrder                              : 0
    ID                                       : 0
    ID                                       : 0
    Format                                   : MPEG-4 Visual
    Format                                   : MPEG-4 Visual
    Commercial name                          : MPEG-4 Visual
    Format profile                           : Advanced Simple@L5
    Format settings                          : BVOP2
    Format settings, BVOP                    : 2
    Format settings, BVOP                    : 2
    Format settings, QPel                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : 0
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Format settings, Matrix                  : Default (H.263)
    Internet media type                      : video/MP4V-ES
    Codec ID                                 : XVID
    Codec ID/Hint                            : XviD
    Codec ID/Url                             : http://mediaarea.net/XVID
    Duration                                 : 17160
    Duration                                 : 17 s 160 ms
    Duration                                 : 17 s 160 ms
    Duration                                 : 17 s 160 ms
    Duration                                 : 00:00:17.160
    Duration                                 : 00:00:17:04
    Duration                                 : 00:00:17.160 (00:00:17:04)
    Bit rate                                 : 722134
    Bit rate                                 : 722 kb/s
    Width                                    : 640
    Width                                    : 640 pixels
    Height                                   : 352
    Height                                   : 352 pixels
    Sampled_Width                            : 640
    Sampled_Height                           : 352
    Pixel aspect ratio                       : 1.000
    Display aspect ratio                     : 1.818
    Display aspect ratio                     : 16:9
    Frame rate                               : 25.000
    Frame rate                               : 25.000 FPS
    FrameRate_Num                            : 25
    FrameRate_Den                            : 1
    Frame count                              : 429
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.128
    Delay                                    : 0
    Delay                                    : 00:00:00.000
    Delay                                    : 00:00:00:00
    Delay                                    : 00:00:00.000 (00:00:00:00)
    Stream size                              : 1548978
    Stream size                              : 1.48 MiB (84%)
    Stream size                              : 1 MiB
    Stream size                              : 1.5 MiB
    Stream size                              : 1.48 MiB
    Stream size                              : 1.477 MiB
    Stream size                              : 1.48 MiB (84%)
    Proportion of this stream                : 0.83890
    Writing library                          : XviD0046
    Writing library                          : XviD 1.1.2 (2006-11-01)
    Encoded_Library_Name                     : XviD
    Encoded_Library_Version                  : 1.1.2
    Encoded_Library_Date                     : 2006-11-01
    
    Audio
    Count                                    : 285
    Count of stream of this kind             : 1
    Kind of stream                           : Audio
    Kind of stream                           : Audio
    Stream identifier                        : 0
    StreamOrder                              : 1
    ID                                       : 1
    ID                                       : 1
    Format                                   : MPEG Audio
    Format                                   : MPEG Audio
    Commercial name                          : MPEG Audio
    Format version                           : Version 1
    Format profile                           : Layer 3
    Format settings                          : Joint stereo / MS Stereo
    Mode                                     : Joint stereo
    Mode extension                           : MS Stereo
    Internet media type                      : audio/mpeg
    Codec ID                                 : 55
    Codec ID/Hint                            : MP3
    Codec ID/Url                             : http://www.iis.fraunhofer.de/amm/index.html
    Duration                                 : 17160
    Duration                                 : 17 s 160 ms
    Duration                                 : 17 s 160 ms
    Duration                                 : 17 s 160 ms
    Duration                                 : 00:00:17.160
    Duration                                 : 00:00:17.160
    Bit rate mode                            : VBR
    Bit rate mode                            : Variable
    Bit rate                                 : 123176
    Bit rate                                 : 123 kb/s
    Channel(s)                               : 2
    Channel(s)                               : 2 channels
    Sampling rate                            : 48000
    Sampling rate                            : 48.0 kHz
    Samples count                            : 823680
    Compression mode                         : Lossy
    Compression mode                         : Lossy
    Delay                                    : 0
    Delay                                    : 00:00:00.000
    Delay                                    : 00:00:00.000
    Delay, origin                            : Stream
    Delay, origin                            : Raw stream
    Delay relative to video                  : 0
    Delay relative to video                  : 00:00:00.000
    Delay relative to video                  : 00:00:00.000
    Stream size                              : 259200
    Stream size                              : 253 KiB (14%)
    Stream size                              : 253 KiB
    Stream size                              : 253 KiB
    Stream size                              : 253 KiB
    Stream size                              : 253.1 KiB
    Stream size                              : 253 KiB (14%)
    Proportion of this stream                : 0.14038
    Alignment                                : Aligned
    Alignment                                : Aligned on interleaves
    Interleave, duration                     : 0.60
    Interleave, duration                     : 24
    Interleave, duration                     : 24  ms (0.60 video frame)
    Interleave, preload duration             : 489
    Interleave, preload duration             : 489  ms
    Language                                 : Undefined
    Language                                 : Undefined
    Language                                 : Undefined
    for that source.
    Using:
    Code:
    mediainfo --inform=Video;Width=%Width%\r\nHeight=%Height%\r\nFrame=%FrameRate%\r\nDisplayAspectRatio=%DisplayAspectRatio/String% "g:\TestClips&Co\test.avi"
    would output:
    Code:
    Width=640
    Height=352
    Frame=25.000
    DisplayAspectRatio=16:9
    Maybe that sheds some light on what:
    --Inform=FMT
    Template defined information display.

    FMT is "[xxx;]Text", where xxx can be any one of General, Video, Audio, Text, Chapter,
    Image, or Menu. Text can be the template text, or a filename in the form of
    file:///path

    See --Info-Parameters for available parameters in the text. Parameters must be
    surrounded by "%".

    --Info-Parameters
    Display list of --Inform parameters
    means,...

    Cu Selur

    Ps.: searching for 'mediainfo windows batch' through a search engine should also provide additional examples.
    Image Attached Files
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  8. Thank you so much,

    The double quotation marks were missing at the beginning of the parameter. I did not notice that.

    I have another question about the right method to use that information to automate a recode of many videos at a lower resolution and lower bitratio.

    Do I have to open another thread? Or can I continue here?
    Quote Quote  
  9. No need to open another thread, but I can't really help you with batch scripting in Windows, since I haven't written a batch file in the last 20years or so.
    General idea should be:
    a. loop through all the files
    b. get the resolution of the file
    c. if it's higher than the minimum you find acceptable continue
    d. if it's below the minimum, do your reencoding steps.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  10. Thank you, you helped me. For the batch I take care of it.

    I need it, to know about the size of the frame, if I have to respect restrictions. Example: I only take the size Y (height) of the frame. I divide it in half. If you are less than 480 I skip the file or use original size.

    When I do the recodes I have to give it the size in X at ffmpeg command? If so, can I calculate the size in x dividing half it or do I have to take into account the aspect ratio or something else?

    Also other question: I saw that Staxrip prohibits me some resolutions. And this question comes to me: do I have to calculate these size respecting some rule? Multiple type of 16 or other?

    Since the original video is well seen in my eyes, and the video recoded is 1/4 as a resolution, can I divide the bitTate to a quarter? Or do I have to take into account other things?

    Recodes will be done with Av1 and Opus or X265 Nvidia (Hardware) or multipass x265 and Aac . The original file is x265 or x264 with audio eac3/ac3/aac/mp3.

    I practically need "low" backup copies at reduced bitrate (dimensions) and low resolution.
    Quote Quote  
  11. You will probably need more than 1/4 of the bitrate when using quarter the number of pixels.
    => Maybe better look into using constant quality with NVEnc or constant rate factor with x265 instead of using bitrate based encoding.
    Usually mod2 is enough for hardware compatibility assuming you use YUV 4:2:0 and progressive content.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  12. Originally Posted by Selur View Post
    You will probably need more than 1/4 of the bitrate when using quarter the number of pixels.
    => Maybe better look into using constant quality with NVEnc or constant rate factor with x265 instead of using bitrate based encoding.
    Usually mod2 is enough for hardware compatibility assuming you use YUV 4:2:0 and progressive content.
    But if I use qp or crf i don't know the values of qp or crf. how can I do?
    Last edited by einstein1969; 13th Nov 2023 at 08:11.
    Quote Quote  
  13. Do a few tests, in which you reencode a file with the different values.
    Usually values between 18 and 23 are what most folks use.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  14. The problem is that there are many videos.

    I'm doing an automatic procedure on purpose.
    Quote Quote  
  15. Constant quantizer and crf, both are meant to limit the maximal loss.
    The downside of this is that you can't predict the output size, but you know that if you find a crf that works for a specific content type, you will not get surprising losses in quality.
    Try with a few shorter clips to get a 'feel' for it.
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  16. I don't think it's a feasible road. They are a lot of files codified with very different qp/crf (from 16 to 27). Then I don't know how to group them in equal content types.

    I am seeing that the QP/CRF parameter is not always present in the files. And even the bitrate sometimes is missing. Furthermore, sometimes there is no video and audio size.

    It is a problem to make an automatic procedure.
    Quote Quote  
  17. The qp, crf, bit rate of the source does not matter.
    Okay, you are clearly not understanding me. ¯\_(ツ)_/¯
    => I give up, maybe someone else can help you.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  18. ok. Thanks.
    You have been all too patient.

    However, I think I understood where I was wrong my reasoning.

    Since I had already codified them with QP/CRF right I thought (wrong) that reducing the size of the frame coincided with the reduction of the file size given by the Bitrate (a little more as you said precisely)

    However, I solved the problem with Mediainfo. I continue on the other thread.
    Quote Quote  



Similar Threads

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