I have a folder with a lot of videos that need to be trimmed at the beginning and I also have a text file with the time where the video must start:
- Video_001.mxf
- Video_001.txt
- Video_002.mxf
- Video_002.txt
- Video_003.mxf
- Video_003.txt
- etc.
I can do this for one file and it works:
$start = Get-Content Video_001.txt
ffmpeg -ss $start -i Video_001.mxf -c:v copy -c:a copy ./Trim_Video_001.mxf
As there are like 200 videos within the folder, I'm trying to do this:
$files = get-childitem *.mxf
$time = get-childitem *.txt
$time | foreach-object {
$timename = $_.name
}
$files | foreach-object {
$filename = $_.name
$start = Get-Content $timename
ffmpeg -ss $start -i $filename -c:v copy -c:a copy ./'Trim_'$filename
}
But it trims all the videos with the time in the last text file. How can I fix the code so the mxf file takes its corresponding txt file?
I'm not a programmer, I'm a video editor so I'm kind of newbie on this matter :)
Thanks!