Format Video Length in HH:MM:SS from Command Line
In my experimentation with audio and video manipulation, I've found that most tools prefer to handle time in HH:MM:SS (hour:minute:second) format. I always presumed that using seconds would be easier but I'm barely a novice media tool user, much less a tool creator.
When I wrote the Create Short Preview from Video post, I calculated the video length in seconds with the following command:
length=$(ffprobe $sourcefile -show_format 2>&1 | sed -n 's/duration=//p' | awk '{print int($0)}')]
That was helpful in detecting if a video was long enough to generate a preview for, but I then needed to get that length in HH:MM:SS format:
formattedlength=$(printf "%02d:%02d:%02d\n" $(($length/3600)) $(($length%3600/60)) $(($length%60)))
In the end you need to evaluate loads of individual statements to get your final HH:MM:SS format!
I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...
How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps?
This article serves as a point-by-point...
We all know that MooTools 1.2 can do some pretty awesome animations. What if we want to quickly make two element swap positions without a lot of fuss? Now you can by implementing a MooTools swap() method.
MooTools 1.2 Implementation
MooTools 1.2 Usage
To call the swap...
Note: For this tutorial, I'm using version1 of the Google Translate API. A newer REST-based version is available.
In an ideal world, all websites would have a feature that allowed the user to translate a website into their native language (or even more ideally, translation would be...