Ετήσια αρχεία: 2014


Clone all repositories you have access to over ssh


ssh [email protected] info | cut -f 2 | tail -n +3 | xargs -I {} -n 1 git clone ssh://[email protected]/{}

The above command will connect to the git server (git.bytefreaks.net) that is using  gitolite and get a list of all the repositories you have access to using ssh [email protected] info

The command should return a list similar to this:

hello bytefreaks, this is git@git running gitolite3 v3.5.3.1-1-gf8776f5 on git 1.7.1

 R W	Repo1
 R W	Repo2
 R W	Repo3
 R  	Repo4

From the results, we remove the first 3 lines as they contain no useful information to cloning all the repositories. From the rest of the lines, where each line contains the information for a repository we have access to, we keep the third column only as it is the one that holds the repository name as it is stored on the server.

On the last stage of the pipe we have a list of the names of the repositories, using xargs, we assign each repository name to the special variable {} and processing one result at a time we clone the git repository to the current directory under the folder that is named as the repository.


ffmpeg: Extract audio from .WEBM to .OGG 3

If you need to extract the audio from an .WEBM movie file to an .OGG audio file you can  execute the following:

FILE="the-file-you-want-to-process.webm";
ffmpeg -i "${FILE}" -vn -y "${FILE%.webm}.ogg"

The first command will assign the file name to a variable, we do this to avoid typing errors in the second command where we might want to use the same name for the audio file.

The second command, will use ffmpeg to extract the audio. The -i flag, indicates the file name of the input. We used the flag -vn that will instruct ffmpeg to disable video recording. The -acodec flag will set the output audio codec to vorbis. The -y flag will overwrite output file without asking, so be careful when you use it.

In case we want to automatically process (batch process) all .WEBM video files in a folder we can use the following:

for FILE in *.webm;
do
    echo -e "Processing video '\e[32m$FILE\e[0m'";
    ffmpeg -i "${FILE}" -vn -y "${FILE%.webm}.ogg"
done

The above script will find all .WEBM files in the folder and process them one after the other.

 

UPDATE:

The following command will find all webm files that are in the current directory and in all sub-folders and extract the audio to ogg format.

find . -type f -iname "*.webm" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -y "${FILE%.webm}.ogg";' _ '{}' \;

The filename of the audio file will be the same as the webm video with the correct extension. The webm extension will be removed and replaced by the ogg extension e.g hi.webm will become hi.ogg

 


ffmpeg: Extract audio from .WEBM to .AAC 2

If you need to extract the audio from an .WEBM movie file to an .AAC audio file you can  execute the following:

FILE="the-file-you-want-to-process.webm";
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -strict -2 -y "${FILE%.webm}.aac";

The first command will assign the file name to a variable, we do this to avoid typing errors in the second command where we might want to use the same name for the audio file.

The second command, will use ffmpeg to extract the audio. The -i flag, indicates the file name of the input. We used the flag -vn that will instruct ffmpeg to disable video recording. The -ab flag will set the bit rate to 128k. The -ar flag will set the audio sample rate to 441000 Hz.  The flags -strict -2 are required as the native FFmpeg AAC encoder that is included with ffmpeg is considered an experimental encoder. The -y flag will overwrite output file without asking, so be careful when you use it.

In case we want to automatically process (batch process) all .WEBM video files in a folder we can use the following:

for FILE in *.webm; do
    echo -e "Processing video '\e[32m$FILE\e[0m'";
    ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -strict -2 -y "${FILE%.webm}.aac";
done;

The above script will find all .WEBM files in the folder and process them one after the other.

 

UPDATE:

The following command will find all webm files that are in the current directory and in all sub-folders and extract the audio to aac format.

find . -type f -iname "*.webm" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -strict -2 -y "${FILE%.webm}.aac";' _ '{}' \;

The filename of the audio file will be the same as the webm video with the correct extension. The webm extension will be removed and replaced by the aac extension e.g hi.webm will become hi.aac

 


ffmpeg: Extract audio from .WEBM to .MP3 12

If you need to extract the audio from an .WEBM movie file to an .MP3 audio file you can  execute the following:

FILE="the-file-you-want-to-process.webm";
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";

The first command will assign the file name to a variable, we do this to avoid typing errors in the second command where we might want to use the same name for the audio file.

The second command, will use ffmpeg to extract the audio. The -i flag, indicates the file name of the input. We used the flag -vn that will instruct ffmpeg to disable video recording. The -ab flag will set the bit rate to 128k. The -ar flag will set the audio sample rate to 441000 Hz.  The -y flag will overwrite output file without asking, so be careful when you use it.

In case we want to automatically process (batch process) all .WEBM video files in a folder we can use the following:

for FILE in *.webm; do
    echo -e "Processing video '\e[32m$FILE\e[0m'";
    ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";
done;

The above script will find all .WEBM files in the folder and process them one after the other.

 

UPDATE:

The following command will find all webm files that are in the current directory and in all sub-folders and extract the audio to mp3 format.

find . -type f -iname "*.webm" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";' _ '{}' \;

The filename of the audio file will be the same as the webm video with the correct extension. The webm extension will be removed and replaced by the mp3 extension e.g hi.webm will become hi.mp3