Skip to content

Instantly share code, notes, and snippets.

@HunterAP23
Last active October 21, 2023 06:59
Show Gist options
  • Save HunterAP23/0b5f5b0930ee74654f35a96e1c998960 to your computer and use it in GitHub Desktop.
Save HunterAP23/0b5f5b0930ee74654f35a96e1c998960 to your computer and use it in GitHub Desktop.

Revisions

  1. HunterAP23 revised this gist Aug 26, 2021. 1 changed file with 31 additions and 21 deletions.
    52 changes: 31 additions & 21 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -1,60 +1,70 @@
    $loc = $args[0]
    If ($args.length -eq 0) {
    Write-Host "Defaulting to current directory of $(Get-Location)"
    "Defaulting to current directory of `"$(Get-Location)`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    } ElseIf ( $(Try { Test-Path $args[0].trim() } Catch { $false }) ) {
    Write-Host "Path $loc was found."
    "Path `"$loc`" was found." | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    } Else {
    Write-Host "Path $loc was not found."
    "Path `"$loc`" was not found." | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    exit
    }

    @(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({
    Write-Host "Working on file $_"
    "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    } ElseIf ($codec -eq "vp9") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    } Else {
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    }
    "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({
    Write-Host "Working on file $_"
    "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({
    Write-Host "Working on file $_"
    "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({
    Write-Host "Working on file $_"
    "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    } ElseIf ($codec -eq "vp9") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    } Else {
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    }
    "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({
    If ($_ -notmatch "_RAWVIDEO.avi") {
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$_"
    If ($codec -eq "rawvideo") {
    "File `"$_`" is already in rawvideo AVI format - skipping..." | Out-File -append -noClobber -encoding UTF8 -filepath "$(Get-Location)\media_to_avi.log"
    } Else {
    "Working on file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 -y "$new"
    "Finished file `"$_`"" | Tee-Object -Append -filepath "$(Get-Location)\media_to_avi.log"
    }
    }
    })
  2. HunterAP23 revised this gist Aug 26, 2021. 1 changed file with 21 additions and 21 deletions.
    42 changes: 21 additions & 21 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,17 @@
    $loc = $args[0]
    If ($args.length -eq 0) {
    Write-Host "Defaulting to current directory of $(Get-Location)"
    Write-Host "Defaulting to current directory of $(Get-Location)"
    } ElseIf ( $(Try { Test-Path $args[0].trim() } Catch { $false }) ) {
    Write-Host "Path $loc was found."
    Write-Host "Path $loc was found."
    } Else {
    Write-Host "Path $loc was not found."
    exit
    Write-Host "Path $loc was not found."
    exit
    }

    @(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    @@ -23,23 +23,23 @@ If ($args.length -eq 0) {
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    @@ -51,10 +51,10 @@ If ($args.length -eq 0) {
    })

    @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({
    If ($_ -notmatch "_RAWVIDEO.avi") {
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    If ($_ -notmatch "_RAWVIDEO.avi") {
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })
  3. HunterAP23 revised this gist Aug 26, 2021. 1 changed file with 14 additions and 8 deletions.
    22 changes: 14 additions & 8 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -10,32 +10,36 @@ If ($args.length -eq 0) {

    @(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({
    Write-Host "Working on file $_"
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 ($_).FullName
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    } ElseIf ($codec -eq "vp9") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    } Else {
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "($_).FullName"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    @@ -47,8 +51,10 @@ If ($args.length -eq 0) {
    })

    @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    If ($_ -notmatch "_RAWVIDEO.avi") {
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })
  4. HunterAP23 revised this gist Aug 26, 2021. 1 changed file with 6 additions and 8 deletions.
    14 changes: 6 additions & 8 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -22,17 +22,15 @@ If ($args.length -eq 0) {
    @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_HEVC.mp4"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({
    If ($_ -notmatch '_HEVC.mp4') {
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_HEVC.mp4"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({
    @@ -51,6 +49,6 @@ If ($args.length -eq 0) {
    @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_HEVC.mp4"
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })
  5. HunterAP23 revised this gist Aug 26, 2021. 1 changed file with 33 additions and 11 deletions.
    44 changes: 33 additions & 11 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,16 @@
    @(Get-ChildItem -File -Recurse -Filter *.webm).foreach({
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 ($_).FullName
    $loc = $args[0]
    If ($args.length -eq 0) {
    Write-Host "Defaulting to current directory of $(Get-Location)"
    } ElseIf ( $(Try { Test-Path $args[0].trim() } Catch { $false }) ) {
    Write-Host "Path $loc was found."
    } Else {
    Write-Host "Path $loc was not found."
    exit
    }

    @(Get-ChildItem -Path $loc -File -Filter *.webm).foreach({
    Write-Host "Working on file $_"
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    @@ -9,20 +19,25 @@
    }
    })

    @(Get-ChildItem -File -Recurse -Filter *.mov).foreach({
    @(Get-ChildItem -Path $loc -File -Filter *.mov).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    $new = "$pat\$(($_).BaseName)_HEVC.mp4"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -File -Recurse -Filter *.mp4).foreach({
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    @(Get-ChildItem -Path $loc -File -Filter *.mp4).foreach({
    If ($_ -notmatch '_HEVC.mp4') {
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_HEVC.mp4"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })

    @(Get-ChildItem -File -Recurse -Filter *.mkv).foreach({
    $pat = Split-Path ($_).FullName
    @(Get-ChildItem -Path $loc -File -Filter *.mkv).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    @@ -31,4 +46,11 @@
    } Else {
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })

    @(Get-ChildItem -Path $loc -File -Filter *.avi).foreach({
    Write-Host "Working on file $_"
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_HEVC.mp4"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })
  6. HunterAP23 revised this gist Aug 3, 2021. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions media_to_avi.bat
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    @echo off

    setlocal EnableDelayedExpansion
    for %%a in (*.webm *.mkv) do (
    FOR /F "usebackq" %%F IN (`ffprobe -v error -select_streams v:0 -show_entries stream^=codec_name -of default^=noprint_wrappers^=1:nokey^=1 "%%a"`) DO (
    if "%%F"=="vp8" (
    ffmpeg -hide_banner -c:v libvpx -i "%%a" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "%%~dpna_RAWVIDEO.avi"
    ) else (
    if "%%F"=="vp9" (
    ffmpeg -hide_banner -c:v libvpx-vp9 -i "%%a" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "%%~dpna_RAWVIDEO.avi"
    ) else (
    ffmpeg -hide_banner -i "%%a" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "%%~dpna_RAWVIDEO.avi"
    )
    )
    )
    )

    for %%a in (*.mp4 *.mov) do (
    ffmpeg -hide_banner -i "%%a" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "%%~dpna_RAWVIDEO.avi"
    )
  7. HunterAP23 revised this gist Aug 3, 2021. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }ElseIf{
    } ElseIf ($codec -eq "vp9") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })
    @@ -19,4 +19,16 @@
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -File -Recurse -Filter *.mkv).foreach({
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    } ElseIf ($codec -eq "vp9") {
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    } Else {
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })
  8. HunterAP23 revised this gist Aug 3, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -3,20 +3,20 @@
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }ElseIf{
    ffmpeg -hide_banner -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })

    @(Get-ChildItem -File -Recurse -Filter *.mov).foreach({
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -File -Recurse -Filter *.mp4).foreach({
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    ffmpeg -hide_banner -hwaccel auto -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })
  9. HunterAP23 revised this gist Aug 3, 2021. No changes.
  10. HunterAP23 created this gist Aug 3, 2021.
    22 changes: 22 additions & 0 deletions media_to_avi.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    @(Get-ChildItem -File -Recurse -Filter *.webm).foreach({
    $pat = Split-Path ($_).FullName
    $codec = ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    If ($codec -eq "vp8") {
    ffmpeg -hide_banner -c:v libvpx -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }ElseIf{
    ffmpeg -hide_banner -c:v libvpx-vp9 -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    }
    })

    @(Get-ChildItem -File -Recurse -Filter *.mov).foreach({
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })

    @(Get-ChildItem -File -Recurse -Filter *.mp4).foreach({
    $pat = Split-Path ($_).FullName
    $new = "$pat\$(($_).BaseName)_RAWVIDEO.avi"
    ffmpeg -hide_banner -i "$(($_).FullName)" -pix_fmt rgba -c:v rawvideo -c:a aac -q:a 5 "$new"
    })