How to rotate all videos in directory using Ffmpeg

if (!$argv['1']) { exit("php rotate_360.php input_dir output_dir degress_to_rot"); } print_r($argv); $input_dir = $argv['1']; $output_dir = $argv['2']; if (!file_exists($output_dir)) { @mkdir($output_dir); } $degress = !empty($argv['3']) ? $argv['3'] : 360; $files = glob("{$input_dir}/*.mp4"); foreach ($files as $key => $file) { $filename = pathinfo($file, PATHINFO_FILENAME); // outputs nameonly $command = "ffmpeg -i {$input_dir}/{$filename}.mp4 -c copy -metadata:s:v:0 rotate={$degress}{$output_dir}/{$filename}-out.mp4"; echo $command . "\n"; shell_exec($command); }

April 19, 2020 · 1 min · Saqib Razzaq

FFMPEG Cheatsheet

add subtitles You can hardcode subtitles by providing a subtitles files and running the following command ffmpeg -i input.mp4 -vf out.mp4 add watermark in any position The base command for adding watermark looks like this ffmpeg -i input.mp4 -i watermark.png -filter_complex "POSITION_HERE" out.mp4 You can replace POSITION_HERE with any position you need from the following Top Right overlay=main_w-overlay_w-10:10 Top Left overlay=10:10 Bottom Right overlay=main_w-overlay_w-10:main_h-overlay_h-10 Bottom Left overlay=10:main_h-overlay_h-10 Center overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2...

August 11, 2019 · 2 min · Saqib Razzaq

Markdown Syntax Guide

This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. ...

March 11, 2019 · 3 min · Hugo Authors