VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. please can u help a cat?

    however

    consider, as example, this mkv file:

    https://www.swisstransfer.com/d/35a45ca1-5123-460b-8d40-d295429aafe0

    In Avidemux --> File -->Open --> c:\example.mkv

    and then

    from menu "File" --> "Project Script" --> "Save as Project" --> c:\example.py

    This is the example.py opened with the notepad:

    Code:
    #PY  <- Needed to identify #
    #--automatically built--
    
    adm = Avidemux()
    if not adm.loadVideo("C:/example.mkv"):
        raise("Cannot load C:/example.mkv")
    adm.clearSegments()
    adm.addSegment(0, 120000, 4720000)
    adm.markerA = 0
    adm.markerB = 4720000
    adm.setHDRConfig(1, 1, 1, 1, 0)
    adm.videoCodec("Copy")
    adm.audioClearTracks()
    adm.setSourceTrackLanguage(0,"und")
    adm.setSourceTrackLanguage(1,"und")
    if adm.audioTotalTracksCount() <= 0:
        raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount()))
    adm.audioAddTrack(0)
    adm.audioCodec(0, "copy")
    adm.audioSetDrc2(0, 0, 1, 0.001, 0.2, 1, 2, -12)
    adm.audioSetEq(0, 0, 0, 0, 0, 880, 5000)
    adm.audioSetChannelGains(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
    adm.audioSetChannelDelays(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
    adm.audioSetChannelRemap(0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
    adm.audioSetShift(0, 0, 0)
    if adm.audioTotalTracksCount() <= 1:
        raise("Cannot add audio track 1, total tracks: " + str(adm.audioTotalTracksCount()))
    adm.audioAddTrack(1)
    adm.audioCodec(1, "copy")
    adm.audioSetDrc2(1, 0, 1, 0.001, 0.2, 1, 2, -12)
    adm.audioSetEq(1, 0, 0, 0, 0, 880, 5000)
    adm.audioSetChannelGains(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
    adm.audioSetChannelDelays(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
    adm.audioSetChannelRemap(1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
    adm.audioSetShift(1, 0, 0)
    adm.setContainer("MKV", "forceAspectRatio=False", "displayWidth=1280", "displayAspectRatio=2", "addColourInfo=False", "colMatrixCoeff=2", "colRange=0", "colTransfer=2", "colPrimaries=2")
    but now please consider only this line:

    Code:
    adm.markerB = 4720000
    so this value (4720000) is the "duration" of entire clip from start to end in Avidemux.

    I wonder: is there a way to get this value with a batch procedure, but without having - every time for a single file - manually open Avidemux and --> "Open file" -->"Save project" --> open in notepad and get the value?

    I mean: is there a way, with a batch, to automatic get the value (in this case is 4720000)

    so the final result is:

    Code:
    4720000
    ?

    OR

    eventually: is there a way to execute in commandline something like:

    Code:
    avidemux.exe --load c:\example.mkv
    [and save the project in a .py file] ?

    My target is simple to get:

    Code:
    4720000
    and not other.

    thanks
    Quote Quote  
  2. Just use ffprobe. It will get the duration in seconds:

    Code:
    ffprobe.exe -v quiet -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 >duration.txt
    set /p duration=<duration.txt
    
    ffmpeg... b:v=DESIRED_STREAM_SIZE_IN_BYTES*8/%duration%...
    Of course, you should already know how to do this as you've done similar things before.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    Just use ffprobe. It will get the duration in seconds:

    Code:
    ffprobe.exe -v quiet -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 >duration.txt
    set /p duration=<duration.txt
    
    ffmpeg... b:v=DESIRED_STREAM_SIZE_IN_BYTES*8/%duration%...
    Of course, you should already know how to do this as you've done similar things before.
    mmm thanks but if I do, on c:\example.mkv

    Code:
    rem
    if exist c:\duration.txt del c:\duration.txt
    rem
    ffprobe.exe -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 "c:\example.mkv">c:\duration.txt
    rem
    duration.txt is:
    Code:
    N/A
    how can it be?
    thanks
    Quote Quote  
  4. It appears you video stream has no time codes. Try using "format=duration" instead of "stream=duration".
    Quote Quote  
  5. Code:
    if exist "%cd%\duration3.txt" del "%cd%\duration3.txt"
    ffprobe64bit2022.exe -v error -select_streams v:0 -show_entries format=duration -print_format default=nokey=1:noprint_wrappers=1 "c:\Volumes\tmp_whatsapp.avs\tmp_whatsapp.avi">"%cd%\duration3.txt"
    fart.exe -q "%cd%\duration3.txt" . --remove
    set /p AviDemuxDur=<duration3.txt
    ah wow
    but please keep in mind the brain-cat-limited

    so that using
    Code:
    fart.exe -q "%cd%\duration3.txt" . --remove
    so for example i get
    Code:
    26560000
    from
    Code:
    26.560000
    is a vulgarity but however seems to works
    Quote Quote  



Similar Threads

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