VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    And, what are all the video extensions supported by mkvmerge?

    I scan several folders searching videos and when I find one I have two options:
    -Read only the extension and ignore it if it's not supported by mkvmerge.
    -Request mkvmerge to read the file and inform me if it is supported or not.

    Although these are two options I want to know both techniques.

    For example in the first case the result would be like this:
    extSupport = ["mkv", "mp4", "mov"]

    Code:
    if (extFile in extSupport){
        ...instructions
    }
    But I don't know what ALL the extensions are and I'd like to know.

    In the second case I just want to give a video to mkvmerge and have it return 'true' if it supports it or 'false' if it doesn't.
    Quote Quote  
  2. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    I may be missing something here, but since mkv, mp4, mov, avi are containers and can contain multiple different types of videos, just checking if the extension is supported or not is pointless.

    Edit: I did a test with an mp4 and changed the extension to mkv, mov, avi and wmv. MKVToolNix opened them with no problem as, as I suspected it probably ignores the extension.
    Last edited by lingyi; 18th May 2020 at 22:09. Reason: Additional info
    Quote Quote  
  3. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    Originally Posted by lingyi View Post
    Edit: I did a test with an mp4 and changed the extension to mkv, mov, avi and wmv. MKVToolNix opened them with no problem as, as I suspected it probably ignores the extension.
    Yes, I am aware of that, however I need the extensions because I have to iterate thousands of files and what better than to ignore those with unsupported extensions, I will know later if it is valid or not.
    Quote Quote  
  4. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    I know it doesn't really like .AVI containing h264 and doesn't like .WMV.
    Quote Quote  
  5. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    I still fail to understand what checking file compatibility by extension will do, but you may have success asking in this Reddit

    Seems to me that what you really need is to determine what video/audio parameters MKVMerge supports, regardless of the extension. There's a couple of recent threads about using Mediainfo in batch mode to provide a list of video/audio parameters.
    Quote Quote  
  6. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    Originally Posted by KarMa View Post
    I know it doesn't really like .AVI containing h264 and doesn't like .WMV.
    This is a good example. If that .AVI comes up as FALSE, that doesn't mean all files with an .AVI extension won't open in the program.
    Quote Quote  
  7. Try using mkvmerge's identifiy option (-i) and then reading the return code. (0=supported, 2=not supported, other may be other problems, idk.)
    Quote Quote  
  8. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    Originally Posted by sneaker View Post
    Try using mkvmerge's identifiy option (-i) and then reading the return code. (0=supported, 2=not supported, other may be other problems, idk.)
    That's EXACTLY what I was looking for, thank you.
    Quote Quote  
  9. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    With the command:

    mkvmerge.exe -l

    I got a list and I was able to conclude that these are all the supported extensions... I think.

    listExt =

    "av1,avi,caf,drc,evo,evob,flv,ivf,m1v,m2v,m2ts,m4v ,mkv,mk3d,mov,mp2,mp4,mpe,mpeg,mpg,mpls,mpv,mts,ob u,ogg,ogm,ogv,rm,rmvb,rv,ts,vc1,vob,webm,webmv"


    There are some that don't even look like extensions but that's the conclusion I came to.
    Quote Quote  
  10. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    Quote Quote  
  11. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    Originally Posted by lingyi View Post
    Okay, thanks for the heads-up, I'll fix it later.
    Quote Quote  
  12. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    I recognize most of the names and with the exceptions of .opu and .rv (which I suspect is Real Video), a quick search for <name> extension brought up a description.

    RealMedia (rm,rmvb) video files are really hit and miss as later versions had some major changes that made it incompatible with some earlier software and hardware players as Real wanted to force users to use only their licensed software and hardware. Here's what may be in Real video containers: https://en.wikipedia.org/wiki/RealMedia. There's also .ra (Real Audio) and .ram (Real Audio, streaming only) which again in later versions may be incompatible with early players. https://en.wikipedia.org/wiki/RealAudio

    Apple did the same thing with QuickTime, particularly with QuickTime Pro which at least for a while could only be played back with the updated (pay) QuickTime Pro software.

    .mpe is .mpeg. I remember getting files created on Macs with the four letter extension and they would be truncated by Windows. Back then (Win 3.1 - Win 98), Windows software still relied heavily on file extensions to recognize files and I would have to rename them to .mpg to play properly.
    Quote Quote  
  13. The way this should be treated and built is on catching errors, something as sneaker offered. Using any programming language. If windows batch script, just setup your command line and then:
    if %errorlevel%==0 ( ok code here)


    you can filter your files by extensions before as you do, it might be a good idea but you should catch errors as well
    Quote Quote  
  14. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    Originally Posted by _Al_ View Post
    you can filter your files by extensions before as you do, it might be a good idea but you should catch errors as well
    Yes I intend to detect errors, extensions are a separate issue so I don't have to iterate too much, imagine if in 10.000 files I am checking each one for errors when most of them are probably not videos. It's a waste of resources.

    The command:

    mkvmerge -i videopath

    It doesn't return 0 or 1 or true or false, it returns a message and based on that message I can know if the video is supported or not, do you know any alternative to just getting true or false?

    @lingyi

    In the end I decided to gather all the video extensions that MPC and PotPlayer shows me and use them in my script:

    listExt =

    "3g2,3ga,3gp,3gp2,3gpp,amr,amv,asf,avi,bdmv,bik,di vx,dpg,dsa,dsm,dss,dsv,dvr-ms,evo,f4v,flc,fli,flic,flv,hdmov,hevc,ifo,ivf,k3g ,m1v,m2p,m2t,m2ts,m2v,m4b,m4p,m4v,mjpeg,mk3d,mkv,m ov,mp2v,mp4,mp4v,mpe,mpeg,mpg,mpls,mpv2,mpv4,mts,m xf,nsr,nsv,ogm,ogv,pva,qt,ram,rec,rm,rmm,rmvb,rp,r pm,rt,skm,smi,smil,smk,ssif,swf,tp,tpr,trp,ts,vob, webm,wm,wmp,wmv,wtv"


    If the extension of a file matches the list then I use mkvmerge and check whether the video is supported or not. Obviously .wmv and some others (which ones?) shouldn't be on the list but I've put it in case anyone is interested in having the all video extensions listed, well I don't know if they are "all" but they are most.
    Last edited by curiosport; 23rd May 2020 at 04:06.
    Quote Quote  
  15. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    Okay, you've explained what and why you're trying to do what you asked in the OP, but my curiosity is still peaked with, "What is your end goal?" Since you're using MKVMerge, it seems apparent that you're planning to put the supported files into an .mkv container. But just doing that doesn't necessarily meant that it will work in a media player that doesn't support the file, and the file will suddenly work just because it's in an .mkv container.

    I highly suspect that at some point you're going to have to confirm which codecs/file parameters in an .mkv container work correctly, making the task of determining which extensions are supported a moot point.

    As for searching extensions, I would just use Everything which can index files by any search term across multiple drives and folders. To limit it to a single drive, use <drive letter>: and the term you're looking for. I've used it to find thousands of files, example mkv across 16+ HDDs at once.
    Last edited by lingyi; 23rd May 2020 at 03:49.
    Quote Quote  
  16. Member
    Join Date
    Aug 2018
    Location
    Colombia
    Search PM
    Originally Posted by lingyi View Post
    "What is your end goal?"
    Extract the audio (from any video) and then put it into a video .mkv, the solution seems far-fetched but no, it is a specific task for a specific problem. Anyway, I'd say I'm done with this step.
    Quote Quote  
  17. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    Interesting. Let us know if you have success with that.

    A more practical approach for others may be the following:

    *Thanks to jagabo for the original command line.

    You need the CLI version of Mediainfo: https://mediaarea.net/en/MediaInfo/Download/Windows

    Add the following in a batch file:

    For /R %%F IN (*.*) do ("<Replace with the location of>:\MediaInfo.exe" "%%F" >"%%~dpnF.txt") Remove the /R if you don't need to search subdirectories

    This will create a .txt file with the original file name for each file

    Use Note++ https://notepad-plus-plus.org/downloads/ and use "codec" in Find In Files to list the video/audio properties listed by MediaInfo. This allows you to use/ignore formats you choose, while ignoring extensions.

    Example:

    a:\cross\vol.1.txt (7 hits)
    Line 15: Codec ID : WMV3
    Line 16: Codec ID/Info : Windows Media Video 9
    Line 17: Codec ID/Hint : WMV3
    Line 18: Description of the codec : Windows Media Video 9 - Professional
    Line 40: Codec ID : 161
    Line 41: Codec ID/Info : Windows Media Audio
    Line 42: Description of the codec : Windows Media Audio 9.2 - 192 kbps, 48 kHz, stereo 1-pass CBR

    a:\cross\VOL.10.txt(4 hits)
    Line 21: Codec ID : XVID
    Line 22: Codec ID/Hint : XviD
    Line 46: Codec ID : 55
    Line 47: Codec ID/Hint : MP3

    Edit: Text files for for files without video/audio will be created, but ignored by Note++ because there's no codec text.
    Last edited by lingyi; 23rd May 2020 at 08:39.
    Quote Quote  
  18. Originally Posted by curiosport View Post
    It doesn't return 0 or 1 or true or false, it returns a message and based on that message I can know if the video is supported or not, do you know any alternative to just getting true or false?
    I see, you may try to redirect that output text and check for errors in it, it might work, something like there: https://stackoverflow.com/questions/1164049/batch-files-error-handling

    Code:
    c:\mypath\myexe.exe | find "ERROR" >nul2>nul
    if ERRORLEVEL 1 ( code solving error here )
    check if this works with mkvmerge, replace"ERROR" string with your string that is in your error message, or there are other codes in that thread
    Last edited by _Al_; 23rd May 2020 at 10:25.
    Quote Quote  
  19. Also to run mediainfo and check formats and all other properties you can use that "run_mediainfo" subroutine:
    https://forum.videohelp.com/threads/377677-Video-batch-files#post2468981
    or something from post below that if just checking one value
    Quote Quote  



Similar Threads