VideoHelp Forum




+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 46 of 46
  1. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Cool!
    Quote Quote  
  2. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    very!
    Quote Quote  
  3. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Just to add.

    I did find a sample clip that incorrectly outputs a count of 30 subtitles when according to Mediainfo there are only 18.
    Of the 18 the first 13 display.

    So the "find" method is probably ok only 99% of times? It does correctly report 1 subtitle when there is only 1. I need to test some other sample with more than 1 subtitle to see how it goes. It may be just this sample below that trips "find" up.

    Sample clip ... https://www.dropbox.com/scl/fo/6wmpyix0s7r0xkwh9bkac/APV1MjwnwzAQ2vx6QHMTbGM?rlkey=v33...75qj5y9rm&dl=0
    Last edited by JN-; 29th Dec 2024 at 14:52.
    Quote Quote  
  4. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Originally Posted by JN- View Post
    Just to add.

    I did find a sample clip that incorrectly outputs a count of 30 subtitles when according to Mediainfo there are only 18.
    Of the 18 the first 13 display.
    I don't know the reason behind that. Is it MediaInfo? Is it my method with ffmpeg? Is it a badly created video file?
    I would use MKVToolNix on those files to create a new mkv.
    Quote Quote  
  5. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Hi pcspeak. If its only subtitles I don't mind that much. My main reason for this was to confirm if an input file had audio and or video stream.

    I am currently getting a file that will have multiple audio and subtitles streams to test. If it's OK then I'm calling it aok.

    It could well me just a funny sample as supplied.
    Quote Quote  
  6. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    OK. I just tested a video with 1 video stream, 5 audio streams and 11 Subtitle streams and your method works aok.
    Perhaps it's the .m2ts sample clip I earlier supplied that's the issue.
    Quote Quote  
  7. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    I just tested another video. an mkv file. VLC (using MakeMKV) and Medianfo show 12 Subtitle streams but the "find" util shows 24.

    So it may be the case that the "Subtitle:" text string is sometimes used twice for each subtitle, depending on the source video, in this case a BR.

    I'll test shortly the .m2ts version.
    Quote Quote  
  8. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Ok, I tested an m2ts sample that contains 4 subtitles as per Mediainfo and VLC. The "find" method reports 6. So cannot even assume that the correct amount = 1/2 if testing m2ts or MKV file that's sourced from BR.
    Quote Quote  
  9. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Originally Posted by JN- View Post
    Just to add.
    I did find a sample clip that incorrectly outputs a count of 30 subtitles when according to Mediainfo there are only 18.
    Sample clip ... https://www.dropbox.com/scl/fo/6wmpyix0s7r0xkwh9bkac/APV1MjwnwzAQ2vx6QHMTbGM?rlkey=v33...75qj5y9rm&dl=0
    The subs found by ffmpeg in your uploaded video are in the standard DVD/Blu-Ray graphics format. There are duplicates in a different display size for the graphic subs. Some programs will count them and some will ignore them.
    I extracted all the subs ffmpeg could handle.
    You can do it yourself. Invalid streams (video & audio) cause crashes. Ignore them. (p.s. I changed the video name.)
    extractSubs01.cmd
    Code:
    for %%a in (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) do ffmpeg -i "v1,a7,s18.m2ts" -map 0:%%a -c:s copy "%%a.sup"
    Loaded a couple of the subs into Subtitle Edit OK. To go further you need to run OCR against each subtitle file.

    If ffmpeg is missing some of the subs using my small batch file, you may wish to find an alternate method. The video and audio counts were correct.
    Quote Quote  
  10. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Ok, that's a brilliant bit of code. It does indeed output the correct number of sutitle files that corresponds to the number reported by VLC and Mediainfo.

    I thought I could get it via the subtitles index number but no.

    I give up, I mean I could run your above code and then count the number of files, if I really needed it. Thanks. It's brilliant but a bit clunky for my needs.

    What I will do is I will leave the "find" method available for all input files that are not .m2ts. That won't work because the MKV files (with internal AVC) derived from BR will still give wrong count.

    I will leave out counting subtitles because anyway for my util(s) I really only needed to check that there is at least one audio/video stream. The subtitles count was simply a bonus, not.

    Thanks pcspeak for all your efforts.

    "The video and audio counts were correct." Indeed.
    Quote Quote  
  11. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    Here's a quick rewrite.
    It removes streams from the count where ffmpeg cannot find a valid subtitle parameter (these were being included in the count. my bad)
    The extra streams with the larger display size still remain.
    stream-count v02.cmd
    Code:
    @echo off
    setlocal EnableDelayedExpansion
    
    if exist Video-List.txt del /q Video-List.txt
    for %%a in ("*.m2ts", "*.mkv", "*.mp4") do (
        echo %%a >> video-list.txt
        for %%b in (Video: Audio: Subtitle:) do ffmpeg -i "%%a" -y nul 2>&1 | find "%%b" | find /v /c "parameters" >> Video-List.txt
        echo. >> Video-List.txt
    )
     start "" /I Video-List.txt

    may be of use to you.
    Cheers.
    Quote Quote  
  12. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Thanks. Gone to bed, heading towards 3am.

    I'll look at that tomorrow. Thank you.
    Quote Quote  
  13. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    That's it, really well done. I ran it on a selection of full length and shortened (to 8 minutes by ffmpeg) clips.

    It worked correctly except for the Audio count for one of the .m2ts 8 minutes clips. The correct output for this is 8A, 1V and 12S.
    Your new method outputs 9A 1V 12S.

    In the older "find" method it actually is worse, which I never noticed, it outputs 10 Audio instead of 8A. Your latest outputs 9A.

    The full length version of this .m2ts video does output correctly 8A, verified by your new method, VLC, Mediainfo and the older "find" method.

    This 8 minute clip is also 8A 1V 12S verified by VLC and Mediainfo.

    I left this 8 minute clip in the same location as per previous link.

    Perhaps this is as good as it gets?
    Last edited by JN-; 30th Dec 2024 at 08:32. Reason: Still not bad.
    Quote Quote  
  14. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    One other thing. My preference is to test a single input file, not multiples. So I normally modify your syntax accordingly.

    In your previous syntax this worked aok but not now if the input file has spaces in the filename.

    if exist Video-List.txt del /q Video-List.txt
    for %%a in ("%~n1%~x1") do (
    echo %%a >> video-list.txt
    for %%b in (Video: Audio: Subtitle do ffmpeg -i "%%a" -y nul 2>&1 | find "%%b" | find /v /c "parameters" >> Video-List.txt
    echo. >> Video-List.txt
    )
    start "" /I Video-List.txt

    I can use the the above "%~n1%~x1" or variable "%_INPUT_FILE%" or %_INPUT_FILE%.
    No matter what combination of %_INPUT_FILE% " %_INPUT_FILE%" etc that I use it doesn't work with spaces.

    I have tried ...
    SET _INPUT_FILE=%~n1%~x1
    SET _INPUT_FILE="%~n1%~x1"

    So the following will always produce 0 vid 0 aud 0 sub
    "4s- Air-Show.mov"
    0
    0
    0

    if exist Video-List.txt del /q Video-List.txt
    for %%a in ("%~n1%~x1") do (
    echo %%a >> video-list.txt
    for %%b in (Video: Audio: Subtitle do ffmpeg -i "%%a" -y nul 2>&1 | find "%%b" | find /v /c "parameters" >> Video-List.txt
    echo. >> Video-List.txt
    )
    start "" /I Video-List.txt
    Last edited by JN-; 30th Dec 2024 at 07:38.
    Quote Quote  
  15. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Found fix for single input file syntax.

    if exist Video-List.txt del /q Video-List.txt
    for %%a in ("%~n1%~x1") do (
    echo %%a >> video-list.txt
    for %%b in (Video: Audio: Subtitle do ffmpeg -i "%~n1%~x1" -y nul 2>&1 | find "%%b" | find /v /c "parameters" >> Video-List.txt
    echo. >> Video-List.txt
    )
    start "" /I Video-List.txt


    if exist Video-List.txt del /q Video-List.txt
    for %%b in (Video: Audio: Subtitle do ffmpeg -i %_INPUT_FILE% -y nul 2>&1 | find "%%b" | find /v /c "parameters" >> Video-List.txt
    echo. >> Video-List.txt

    start "" /I Video-List.txt


    ffmpeg -i "%_INPUT_FILE%" -y nul 2>&1 | find "Subtitle:" | find /v /c "parameters">subtitle-streams-count.txt
    Last edited by JN-; 31st Dec 2024 at 05:35.
    Quote Quote  
  16. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    Given that it's only one outlier file that isn't working out maybe this is good enough.
    Quote Quote  



Similar Threads

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