VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 33
Thread
  1. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, I have multiple files in a folder.
    If i play the video , i could just click the codec menu to view the codec
    But , if i want to know that all files in the folder are having the same codec, both audio and video. if not it may list out those that are not having the same codec.
    Is there any specific command in ffprobe or ffmpeg to do this.
    i want a single line formula for this .
    please help.
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    One solution https://stackoverflow.com/questions/2869281/how-to-determine-video-codec-of-a-file-wit...fmpeg/29610897

    Since you wish to check ALL files at once, you will it would be better to call a batch file with a single command using MEDIAINFO that repeats and outputs to a text file.

    Code:
    setlocal enabledelayedexpansion
    @echo off > FPS.txt
    for %%a in ("*.mp4","*.mpg","*.flv") Do (
    cd %%~dpa
    ver > nul
    echo %%a >> codecs.txt
    MediaInfo.exe --Output="Audio;%%Codec%% %%CodecID%%" "%%a" 
    MediaInfo.exe --Output="Video;%%Codec%% %%CodecID%%\r\n" "%%a" 
    )
    Yields in coecs.txt file:
    0_1_xInstagram.mp4
    AAC LC mp4a-40-2
    AVC avc1

    merged_T0_0_xInstagram.mp4
    AAC LC mp4a-40-2
    AVC avc1

    new.mp4
    AAC LC mp4a-40-2
    AVC avc1

    T0_0_xInstagram.mp4
    AAC LC mp4a-40-2
    AVC avc1

    xInstagram.mp4
    AAC LC mp4a-40-2
    AVC avc1
    Quote Quote  
  3. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, budman,
    media info contain some more files other than the exe.
    can i just copy the media info exe in the folder i want to use
    i once ran the cmd with echo on , as the screen went off in the echo off
    I willl try by copying mediainfo exe in to the directory and report
    thanks for the code.
    i tried but without success
    expecting replly from you
    Last edited by jraju; 8th Feb 2021 at 23:48.
    Quote Quote  
  4. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Yes mediainfo should be in the same directory as your videos.
    Quote Quote  
  5. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    please find enclosed the result
    Am I making some mistake
    what i really want is to show only the files that are not matching with the first file.
    I do not have any other extension other than mp4 and these may contain different video and audio outputs.
    what i need is , check video and audio codec, that will be listed as first file, the formula may check the match of codecs with this file , and if found difference in codec, list the file that differs.
    The result file codec txt contain the file name, of all files in the folder and it also opens the media info gui screen.
    Image Attached Thumbnails Click image for larger version

Name:	foldercodecchecknew.jpg
Views:	58
Size:	378.1 KB
ID:	57286  

    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    My mistake. I wrote the code to list all the files and their codecs so you could look for any that were different in the list.
    If I understand now, you wish to use 1 video as a reference and check all other videos, listing only those that are different. Correct? Did you need to check all the audio streams in a video, if it has more than 1?
    Quote Quote  
  7. Member stax76's Avatar
    Join Date
    Nov 2009
    Location
    On thin ice
    Search PM
    Maybe have a look at my project MediaInfo.NET, it has a folder grid view feature with sortable columns where you can sort by audio and video codec or filter by keywords like avc or hevc.

    https://github.com/stax76/MediaInfo.NET


    Or my command line solution Get-MediaInfo, that's used by StaxRip and MediaInfo.NET for showing the folder grid view. It's 2021, so this is powershell, it is powerful.

    https://github.com/stax76/Get-MediaInfo
    Quote Quote  
  8. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, budman, that is correct, I want to compare the rest of the video and audio codec with that first video codec and audio codec and lilst the difference.
    I want a bat file so that i need not check each one of the file that is there.
    Moreover, i presume, that if the first listed video is as per the explorer content, then I will note down, if the first video has the correct code.
    Or the program bat will take its own list, then it may not give correct details.
    Hi, stax76, I think your ideas are for advanced users .
    Quote Quote  
  9. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    The original bat I gave you should have created a list of all files and their codecs. I thought you wanted to just list all and note the differences. You want only those that are different so that can probably be done with batch or gui. I will work on a program to just note the videos that are different than the reference video. CMD OR GUI?
    Quote Quote  
  10. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    cmd bat file . I will just execute and find it
    is my presumption of the program, will take , the first file as listed in the explorer windows of that folder
    please say, otherwise, if it takes on a kind of alphabetic order, then the result would be not as expected.
    your solution on ffprobe , i
    can you change the formula you linked to include -.mp4
    would that be possible
    Quote Quote  
  11. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Bat/cmd files use their own unique way if selecting which file they choose as first. It would probably be easier to drag/drop your reference file on the cmd and then let it loop thru each of the others for differences.
    I will work on a cmd file that does just that and produces a list of the videos that are different along with their different codecs, similar to my original cmd but listing only the difference videos
    Quote Quote  
  12. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    budman, thank you so much.
    please tell me how to drag or drop my first file, referece to the cmd prompt. Is there a way to a kind of select from dir command
    i really do not know , how to drag fle to cmd pl
    just imagine how it will help most people , who do not find a way
    their different dieices may support a particular video and audio format.
    if the list contains hundreds of video, the bat would list the different that need to be converted to that reference file format.
    this kind of innovation really helps many. waiting for your reply
    Quote Quote  
  13. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Oops wrong batch wrong images. Will post correct
    Last edited by Budman1; 10th Feb 2021 at 22:23.
    Quote Quote  
  14. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    hi, will try budman. You mean cmd file, as bat file . ok
    Shall i select more than one file to this bat file
    or only one fileyour quote
    Then just drag a video and drop it on the CMD icon.
    where is video codec and audio codec. are they shown as points
    please i am a newbie in programming
    Quote Quote  
  15. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Oops wrong post
    Last edited by Budman1; 10th Feb 2021 at 21:59.
    Quote Quote  
  16. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Budman, it seems that you edited your reply to have onlly one time at a time.
    I think you have given that to drag the reference file in to the bat and all files will be scanned
    Time consuming, how much time it will take to complete one file.
    If you remove all other variables except, video codec and audio codec, will it take much time
    i do not think so, because of number of variables , the time is lengthy, i f i may say so.
    could you tell me which lines are to be removed to get the video and audio codec alone
    Quote Quote  
  17. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, i executed your bat, but it is rounding with not responding in the task manager.
    I think , so much parameters cause the delay.
    Quote Quote  
  18. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Oops wrong post
    Last edited by Budman1; 10th Feb 2021 at 21:58.
    Quote Quote  
  19. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Oops wrong post
    Last edited by Budman1; 10th Feb 2021 at 21:57.
    Quote Quote  
  20. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    You wish to know all videos that have different codecs than reference. You drag reference to bat/cmd file and it will create fole called codecs txt. This will list your reference file, its codecs and all files with different codecs as ne list these as my example image shows. I sent wrong file batch. I will send correct one when I am on pc. Sorry, I had 2 requests swapped.
    Quote Quote  
  21. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Okay, I must apologize profusely for the mix up. I was andwering your request from my cell and did not send correct information. To quote now to be sure:

    But , if i want to know that all files in the folder are having the same codec, both audio and video. if not it may list out those that are not having the same codec.
    Code:
    setlocal enabledelayedexpansion
    @echo off > "Vcodec.txt"
    @echo off > "Acodec.txt"
    @echo off > "Codecs.txt"
    
    for %%a in ("%~nx1") Do (
    MediaInfo.exe --Output="Audio;%%Codec%%" "%~nx1" > Acodec.txt
    MediaInfo.exe --Output="Video;%%Codec%%" "%~nx1" > Vcodec.txt
    set /p Video=<"Vcodec.txt"
    set /p Audio=<"Acodec.txt"
    echo Reference %%a >> "Codecs.txt"
    echo Video=!Video!    Audio=!Audio!  >> "Codecs.txt"
    @echo. >> "Codecs.txt"
    )
    
    set /a count=0
    
    for %%b in ("*.mp4","*.mpg","*.mkv") Do (
    cd %%~dpb
    MediaInfo.exe --Output="Audio;%%Codec%%" "%%b" > Acodec.txt
    MediaInfo.exe --Output="Video;%%Codec%%" "%%b" > Vcodec.txt
    set /p NewV=<"Vcodec.txt"
    set /p NewA=<"Acodec.txt"
    
    if  NOT !NewV! == !Video! (
    echo %%b >> codecs.txt  Video
    echo !NewV! >> codecs.txt
    @echo. >> "Codecs.txt"
    )
    if Not !NewA!==!Audio! (
    echo %%b >> "codecs.txt"  Audio
    echo !NewA! >> "codecs.txt"
    @echo. >> "Codecs.txt"
    )
    set /a count+=1
    set /a ekko=count%%10
    if !ekko! EQU 0 echo Frame !count! processed
    )
    This will create 3 folders. Acodec.txt for saving Audio codec, VCodec.txt for saving Video Codec for each file, and Codecs.txt which lists your reference file, its codecs and then lists all other videos that are different and their codecs. Right now as it is it checks "for %%b in ("*.mp4","*.mpg","*.mkv") Do (" files.
    If you want to you can change it CAREFULLY to "for %%b in ("*.mp4") Do (" but it really doesn't matter since you have only MP4's in the folder it will not find any MKV or MPG files. I only added so I could show the files with different codecs.
    Image Attached Thumbnails Click image for larger version

Name:	codec check.jpg
Views:	93
Size:	327.0 KB
ID:	57308  

    Quote Quote  
  22. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, thanks for the revised codec. I had not received email alert of this update.
    today only i am seeing the post, will try budman.
    The process is same is it not.
    just open the bat file and drag the reference file and the rest is saved in files to see ok.
    will try and report back to you.
    Quote Quote  
  23. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, Budman , but i am getting , not responding bat and the cursor is swirling round.
    will it take time to get this result
    please tell me if i am not following correct instructions.
    just drag the reference file to the bat file, by right clicking the bat file and select edit to open and then drag the reference file

    I just ran the script with one reference file and one mkv file, and waited for it to finish without closing anything.
    The script ran for few minutes and then open the reference file as mp4.
    there was no creation of codecs.txt , in the folder, but the mp4 opened with machine characters.
    Am I missing anything.
    valuable bat file, and may well be useful for so many users .
    Last edited by jraju; 13th Feb 2021 at 20:52.
    Quote Quote  
  24. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    There is no reason to open and click edit. It is designed to drag the reference file over the bat ICON. Dropping it on the BAT ICON will activate the bat and test all videos in the reference folder. Open video folder in windows explorer. You should see all your video icons , or some people call them thumbnails, as well as those for mediainfo icon. Drag a video thumbnail and drop it on the bat thumbnail. That's all there is to it. There may be a slight pause with cmd , bat windows but shouldn't be long.
    Quote Quote  
  25. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Budman, this is news to me . I tried , it did open a command prompt and side by side opened the reference file in the media info gui.
    just it shows the details of the reference video in the gui.
    it created a codec.txt, which is as follows and it stops,
    the codec txt contains
    Reference "kbs017.mp4"
    Video= Audio=
    Is there anything missing on my part , shall I leave the gui as it is
    to proceed
    Image Attached Thumbnails Click image for larger version

Name:	batfiletest.jpg
Views:	58
Size:	435.5 KB
ID:	57357  

    Quote Quote  
  26. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    It looks like you are using mediainfo.net? I do not know anything about the command results for it. I just use normal mediainfo not .net.
    I'll attempt to send a zip with all the files I use. Not sure if videohelp allows uploading zip files. If not I will post it to my site and send link.
    Quote Quote  
  27. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    OK I uploaded RAR to Dropbox and shared it. https://www.dropbox.com/s/79wno0dapqy9kv9/New%20folder.rar?dl=0 will open dropbox UnRarred files. To download the whole folder click the 3 dots on the right side and select download.

    Now unrar it and it will create a folder called New Folder. Everything is inside to test. Drag "Sample 1.mp4" to "Check codecs.cmd" and drop it on the icon. There should now be a" Codecs.txt" that is similar to the sample Codecs.txt, listing all the files amnd the difference in their codecs. The will be 2 lines if audio and video are both different..
    Quote Quote  
  28. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, thanks so much for the effort on your codeing. i raised similar query, in other forum, to which i shared the link.
    thanks for the great effort.
    i just subtituted my files in your downloaded folder, with one more dll, i686 dll to get the result. the present mediainfo exe verison , did not work, it pops up the gui interface stopping further process.
    the link I shared is here
    https://www.sevenforums.com/general-discussion/425080-ffmpeg-command-check-if-all-file...ame-codec.html
    Quote Quote  
  29. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Yes I thought it might be the .net version. I will experiment and may e mans ut work with that too.

    Just glad it worked for you.
    Thanks
    Quote Quote  
  30. Member jraju's Avatar
    Join Date
    Mar 2013
    Location
    India
    Search Comp PM
    Hi, Budman,
    what is that message
    10 frames processed
    20 frames processed
    30 frames processed
    shown while processing the files.
    the total filles including the reference files were 36
    Last edited by jraju; 14th Feb 2021 at 08:05.
    Quote Quote  



Similar Threads

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