Tag Archives: bash

MTS to MP4 converter

Following my previous post about iMovie and MTS I always had random trouble with my converter failing/hanging with some  MTS files. And when repeated for the same file – no problems. This way I couldn’t just set the converter to work with tens of files and go for a coffee – I always had to look for hangs and stop the process only to restart it again.

And after I had problems with QuickTime refusing to open the new .mov files and iMovie having no sound, I thought it to be prime time to revisit the script.
Read more »

MacFUSION workaround

Upgrading to OS X 10.6.3 broke the excellent MacFusion mounting app. For those like me, who depend upon SSHFS mount, there is a workaround using static sshfs mounting.

Read more »

FFmpeg steals input

I had a shell wrapper script to convert MTS files with FFmpeg, but somehow, when running on multiple files, only the very first one got converted.

Turns out that FFmpeg swallows the stdin from the bash script when it is run and therefore nothing remains in the stdin for the next iterations. To remedy this, I had to fake input to ffmpeg:

while read movie
do
echo "" | ffmpeg -i "$movie" -vcodec copy -acodec copy "$movie".mov
done

Without the echo command this would’ve ended after first iteration, regardless of the number of files in the input.

BTW, the above command is useful for turning MTS files into MOV files, while preserving the audio-video streams, for software that does not support MTS.

bash SMTP

There might arise situations, where a monitoring script is in dire need to send an e-mail. But how do you send mail when for some reason the mail system itself is dysfunctional?  Bash to the rescue.

Read more »

Bash and Networking

Bash is one of these gems in the computer world that do not require reading manual for most of the basic use. But extensive reading can lead to expertise and such people tend to prefer bash for tasks of increasing complexity whereas others would have already turned to higher level programming languages.

One such case is networking. How many people know that you can do basic socket I/O with bash? One of such people is my coworker, who pointed this out for me.

Read more »