Forum Discussion
Reddwarf4ever
Mar 13, 2022Copper Contributor
Converting video with DTS to AC3 using FFMpeg & PowerShell
I have a number of video files with DTS audio, I need to convert to AC3 Audio, without reprocessing the video. I have been given 2 scripts, the first one A-worked perfectly yesterday but today is thr...
Mar 14, 2022
$output = Join-Path $DirOut -ChildPath ((Get-Item $source).basename + "_out.mkv") fails when there are multiple files found ($source variable) Perhaps you should try this:
$ffpath = "C:\Windows\System32\ffmpeg.exe"
$DirOut = "D:\converted"
foreach ($sourcefile in $source) {
$output = Join-Path $DirOut -ChildPath ((Get-Item $sourcefile).basename + "_out.mkv")
& $ffpath -i $sourcefile -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k $output -loglevel 8 -stats
}
The second script is not PowerShell but batch/cmd, you should save the script in a .cmd file and try to run that...
$ffpath = "C:\Windows\System32\ffmpeg.exe"
$DirOut = "D:\converted"
foreach ($sourcefile in $source) {
$output = Join-Path $DirOut -ChildPath ((Get-Item $sourcefile).basename + "_out.mkv")
& $ffpath -i $sourcefile -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k $output -loglevel 8 -stats
}
The second script is not PowerShell but batch/cmd, you should save the script in a .cmd file and try to run that...
Reddwarf4ever
Mar 14, 2022Copper Contributor
thank you
How does script A know the source folder I.e. Convert ?
$ffpath = "C:\Windows\System32\ffmpeg.exe"
$DirOut = "D:\converted"
foreach ($sourcefile in $source) {
$output = Join-Path $DirOut -ChildPath ((Get-Item $sourcefile).basename + "_out.mkv")
& $ffpath -i $sourcefile -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k $output -loglevel 8 -stats
}
😎😎😎
- Mar 14, 2022Forgot to put this line in my post, it should be the first line
$source = Get-ChildItem -path "D:\convert*" -Recurse -Include *.mkv- Reddwarf4everMar 14, 2022Copper Contributor
Well, Script A worked perfectly Thanks
Script B in a CMD window did nothing, sat there with a flashing cursor ???
does it get too complicated to create folders in the converted folder the same as the convert folder, so the files are converted into like for like folders ?
if it’s complicated I won’t trouble you, just a thought.
thanks again
- Reddwarf4everMar 15, 2022Copper ContributorThe video files converted to AC3 in around 2 1/2 hours, 70 files. But it seems it may not just have been the audio, as they still won’t play on my TV, but will play on an Xbox with VLC player app. Maybe if I used the script you made, but instead of converting the audio, leave that as is and convert the MKV to AVI or MP4 maybe, that may sort out the issues, is that something that can be done easily, sorry to give you another project.
Thanks