0
Thanks

A few words of thanks would be greatly appreciated.

Linux - Bash command to compress video




Issue


I would like to create a script to compress any video file format. Flv, these videos are contained in a directory.

I already have the command to perform the compression using the ffmpeg program.


Here is the command:

"ffmpeg-i video.wmv-ar 22050-ab 32-f flv-s 400x300 video.flv.


I would like to apply this command to all the videos in the current directory except for the video already. Flv, the video file names are not known in advance.

Solution


You can try the following command:
cd /your_directory
for i in *.wmv; do ffmpeg -i "${i}" -ar 22050 -ab 32 -f flv -s 400x300 "${i%.wmv}.flv"; done

Note


Thanks to jipicy for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Linux - Bash command to compress video », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments