Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu - Compressing mp4 files using command line
for f in *.mp4; do echo "Converting $f"; avconv -i "$f" -acodec mp2 -r 25 ./"${f}"-opt.mp4; done
@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Nov 7, 2018

for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -b 1000000 ./opt/"${f}"-opt.mp4; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Nov 8, 2018

for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" ./opt/"${f}"-opt.mp4; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Mar 15, 2019

for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -s 1280x720 -preset superfast ./opt/"${f}"-new.mp4; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Mar 17, 2019

for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -s 720x405 -preset superfast ./opt/"${f}"-new.mp4; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Mar 24, 2019

for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -s 1024x576 -preset superfast ./opt/"${f}"; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented May 2, 2019

// yep !
for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -vf scale=-1:720 -c:v libx264 -crf 18 -preset veryslow -c:a copy ./opt/"${f}"; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented May 16, 2019

// enabling fast preset encoding : -preset fast
// -crf 30
// render good enconding with a smaller file ;)
for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -vf scale=-1:720 -c:v libx264 -crf 30 -preset fast -c:a copy ./opt/"${f}"; done

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Aug 23, 2019

// Video information
mediainfo file.mp4

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Aug 23, 2019

// Meta tag editor for mp3, mp4, etc.
sudo add-apt-repository ppa:ufleisch/kid3
sudo apt update
sudo apt install kid3-qt

// To remove Kid3 tag editor
sudo apt-get remove --autoremove kid3 kid3-*

@obeninteractive

This comment has been minimized.

Copy link
Owner Author

@obeninteractive obeninteractive commented Mar 28, 2020

// hack to error message : "width not divisible by 2"
// 1280x720
// 720x480
for f in *.mp4; do echo "Converting $f"; ffmpeg -i "$f" -s 1280x720 -c:v libx264 -crf 30 -preset fast ./opt/"${f}"-new.mp4; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.