Cut end of multiple videos

前端 未结 3 1105
清酒与你
清酒与你 2021-01-21 20:10

I need a script to cut off the last 6 seconds of multiple videos. The videos do all have different length.

I can‘t find anything helpful online.

Does anyone know

3条回答
  •  长发绾君心
    2021-01-21 20:52

    It is almost impossible to do this for windows batch files. Here is the script for the Powershell:

    $ListsFiles = Get-ChildItem "D:\VIDEOS\1\" -Filter *.avi;    
    
    Foreach ($file in $ListsFiles){
        $input_d = [math]::round((ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $file.Fullname));
    
        $output_duration=$input_d-5;
    
        $ArgumentList = '-i "{0}" -map 0 -c copy -t {1} "D:\VIDEOS\1\output\{2}"' -f $file.Fullname, $output_duration, $file;
        Write-Host -ForegroundColor Green -Object $ArgumentList;   
        Start-Process -FilePath ffmpeg -ArgumentList $ArgumentList -Wait -NoNewWindow;    
    }
    

提交回复
热议问题