diff --git a/Z_Linux_Installations_101/FFMpeg/readme.md b/Z_Linux_Installations_101/FFMpeg/readme.md index e0a116c..795cc81 100644 --- a/Z_Linux_Installations_101/FFMpeg/readme.md +++ b/Z_Linux_Installations_101/FFMpeg/readme.md @@ -5,13 +5,30 @@ Have been playing around with video at: 3. https://jalcocert.github.io/JAlcocerT/asrock-x300-home-server/#video-editing-101 4. https://jalcocert.github.io/JAlcocerT/dji-osmo-action-5-pro/ -## FFMPEG and Linux +## FFMPEG + +### FFMPEG and Linux ```sh ``` -## FFMPEG with Windows +### FFMPEG with Windows + +```sh +# Install Chocolatey (Run as Administrator) +Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-WebRequest -UseBasicParsing 'https://community.chocolatey.org/install.ps1' | Invoke-Expression + +# Verify Chocolatey Installation +choco --version + +# Install FFmpeg (Run as Administrator) +choco install ffmpeg -y +#choco install chocolateygui #optionally, install a UI to install other packages with GUI + +# Verify FFmpeg Installation +ffmpeg -version #I got the version 7.1-essentials_build +``` ```sh diff --git a/Z_Linux_Installations_101/FFMpeg/video_copy.ps1 b/Z_Linux_Installations_101/FFMpeg/video_copy.ps1 new file mode 100644 index 0000000..dd2dca8 --- /dev/null +++ b/Z_Linux_Installations_101/FFMpeg/video_copy.ps1 @@ -0,0 +1,71 @@ +# Define source and destination paths +$source = "C:\Users\j--e-\Desktop\CAM" +$destination = "F:\DCIM\DJI_001" + +# Ensure the destination folder exists +if (!(Test-Path -Path $destination)) { + New-Item -ItemType Directory -Path $destination -Force +} + +# Get all .MP4 files from source +$files = Get-ChildItem -Path $source -Filter "*.MP4" + +# Check if there are files to copy +if ($files.Count -eq 0) { + Write-Host "No MP4 files found in $source." + exit +} + +$totalFiles = $files.Count +$copiedFiles = 0 +$totalBytes = ($files | Measure-Object -Property Length -Sum).Sum +$startTime = Get-Date + +foreach ($file in $files) { + $fileSizeMB = [math]::Round($file.Length / 1MB, 2) + $fileName = $file.Name + $sourcePath = $file.FullName + $destPath = Join-Path -Path $destination -ChildPath $fileName + + $copyStart = Get-Date + Copy-Item -Path $sourcePath -Destination $destPath -Force + $copyEnd = Get-Date + + # Calculate time taken for the copy + $timeTaken = ($copyEnd - $copyStart).TotalSeconds + $speed = if ($timeTaken -gt 0) { [math]::Round($fileSizeMB / $timeTaken, 2) } else { 0 } + + # Update progress + $copiedFiles++ + $percentComplete = ($copiedFiles / $totalFiles) * 100 + + Write-Progress -Activity "Copying MP4 Files" -Status "Processing: $fileName ($copiedFiles of $totalFiles)" -PercentComplete $percentComplete + Write-Host "Copied: $fileName - Size: ${fileSizeMB}MB - Speed: ${speed} MB/s" +} + +$endTime = Get-Date +$totalTime = ($endTime - $startTime).TotalSeconds +$avgSpeed = if ($totalTime -gt 0) { [math]::Round(($totalBytes / 1MB) / $totalTime, 2) } else { 0 } + +Write-Host "`n✅ Transfer complete!" +Write-Host "Total Files: $totalFiles" +Write-Host "Total Size: $([math]::Round($totalBytes / 1MB, 2)) MB" +Write-Host "Total Time: $([math]::Round($totalTime, 2)) seconds" +Write-Host "Average Speed: ${avgSpeed} MB/s" + + +# # Define source and destination paths +# $source = "C:\Users\j--e-\Desktop\CAM" +# $destination = "F:\DCIM\DJI_001" + +# # Ensure the destination folder exists +# if (!(Test-Path -Path $destination)) { +# New-Item -ItemType Directory -Path $destination -Force +# } + +# # Copy only .MP4 files from source to destination +# Get-ChildItem -Path $source -Filter "*.MP4" | ForEach-Object { +# Copy-Item -Path $_.FullName -Destination $destination -Force +# } + +# Write-Host "MP4 files copied successfully!" \ No newline at end of file diff --git a/Z_Linux_Installations_101/FFMpeg/video_tricks.ps1 b/Z_Linux_Installations_101/FFMpeg/video_tricks.ps1 new file mode 100644 index 0000000..d85cae1 --- /dev/null +++ b/Z_Linux_Installations_101/FFMpeg/video_tricks.ps1 @@ -0,0 +1,11 @@ +$camFolderPath = Join-Path -Path "C:\Users\j--e-\Desktop" -ChildPath "CAM" + +if (Test-Path -Path $camFolderPath -PathType Container) { + Set-Location -Path $camFolderPath + + Get-ChildItem -Filter "*.MP4" | ForEach-Object { "file '$($_.Name)'" } | Set-Content file_list.txt + + Write-Host "File list generated in: $($camFolderPath)\file_list.txt" +} else { + Write-Warning "CAM folder not found at: $($camFolderPath)" +} \ No newline at end of file diff --git a/Z_Linux_Installations_101/Readme.md b/Z_Linux_Installations_101/Readme.md index 5e709f9..01306f1 100755 --- a/Z_Linux_Installations_101/Readme.md +++ b/Z_Linux_Installations_101/Readme.md @@ -4,14 +4,14 @@ Trying Linux for the first time? This guide will get you and your system started with **your favourite Apps**. -1. Benchmark a PC/Server: While [testing the x300](https://jalcocert.github.io/JAlcocerT/asrock-x300-home-server/#benchmarks-101) +1. **Benchmark** a PC/Server: While [testing the x300](https://jalcocert.github.io/JAlcocerT/asrock-x300-home-server/#benchmarks-101) ```sh curl -O https://raw.githubusercontent.com/JAlcocerT/Linux/main/Z_Linux_Installations_101/Benchmark101.sh chmod +x Benchmark101.sh & ./Benchmark101.sh ``` -2. [SelfHosting 101](https://jalcocert.github.io/Linux/docs/linux__cloud/selfhosting/): +2. [**SelfHosting** 101](https://jalcocert.github.io/Linux/docs/linux__cloud/selfhosting/): ```sh curl -O https://raw.githubusercontent.com/JAlcocerT/Linux/main/Z_Linux_Installations_101/Selfhosting_101.sh @@ -21,7 +21,7 @@ chmod +x Selfhosting_101.sh sudo ./Selfhosting_101.sh ``` -3. Quick Video Edition with ffmpeg, as covered [here](https://jalcocert.github.io/JAlcocerT/my-action-cam-video-workflow/#quick-videos---ffmpeg-cli) +3. **Quick Video Edition**: with ffmpeg, as covered [here](https://jalcocert.github.io/JAlcocerT/my-action-cam-video-workflow/#quick-videos---ffmpeg-cli) ```sh