Quantcast
Viewing all articles
Browse latest Browse all 151235

FFMPEG Script

Hi. So i wrote this script to remux all videofiles to .mp4 but i think it looks really bad. It does its job, but can i rewrite it so it runs better?

shopt -s globstar

for f in **/.mov; do ffmpeg -y -i "$f" -c copy -sn "${f%.mov}.mp4"; done
for f in **/.mkv; do ffmpeg -y -i "$f" -c copy -sn "${f%.mkv}.mp4"; done
for f in **/.avi; do ffmpeg -y -i "$f" -c copy -sn "${f%.avi}.mp4"; done
for f in **/.flv; do ffmpeg -y -i "$f" -c copy -sn "${f%.flv}.mp4"; done
for f in **/.FLV; do ffmpeg -y -i "$f" -c copy -sn "${f%.FLV}.mp4"; done
find . -name '.mov' -delete
find . -name '.mkv' -delete
find . -name '.avi' -delete
find . -name '.flv' -delete
find . -name '.FLV' -delete

now the script makes a duplicate of the videofile. example: remuxing a .mkv to .mp4. both videofiles is in the folder untill the end of the script where it gets deleted. I want ffmpeg to automatically detect the container and codecs. if it needs to remux then it remux, if it needs transcoding then transcode. also want the script to delete the original video file before going to the next video file. i do not know how to write like that. i found bits and pieces on the interwebz and just tried out commands.

Thanks


Viewing all articles
Browse latest Browse all 151235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>