Saturday, September 14, 2019

Awesomeness of ffmpeg

ffmpeg is a powerfuly CLI tool. It has helped me many times. Assuming that it is installed.

Question: How to covert a video file to an audio file using ffmpeg in Linux

$ ffmpeg -i input-video.mp4 output-audio.mp3
$ ffmpeg -i input-video.mp4 output-audio.wav 

Note: Supports most of the audio formats.

Question: How to increase the audio quality or amplfying the audio in a video  using ffmpeg.

$ ffmpeg -i 'input-video.mp4'  -vcodec copy -af "volume=30dB" 'output-video-30db.mp4'

set volume appropriately as 10/20/30/40 DB depeding on how much audio you need to amplify in your input-video file. This works amazing well. You would not believe it.

Tata, See you.

MKV - dual or multi audio in a singe video file

MKV is one the famous video format for the movie watchers/collectors online.
WIKI says The Matroska Multimedia Container is a free, open-standard container format, a file format that can hold an unlimited number of video, audio, picture, or subtitle tracks in one file.

I am fan of the following feature. You can choose the audio language during play back. It work cools on vlc player. This would avoid creating or downloading multiple times say if we want a movie in Tamil as well as English.

I was really surprised why YouTube or vimeo did not adopt to such kind of player. That can play multiple audios/language. Maybe it will come in future some day.  Currently we have only different language subtitles for one video with single audio track. The future is single video with multiple audio tracks. This could be a boon for video creators.

It would be nice to have a player like this below.  In this below player click the headphone icon -- you can change the lang of video ENGLISH or SPANISH.

https://paellaplayer.upv.es/demos/multi-audio-tracks/

You could create a such a video. But we need a player(as above) to play such video on the web or our website. I still have not figured out how to add paella player to my site.

On a side note. How do we create a such a video. It is easy. There is a tool called MKVToolNix GUI.

Sooner or later YouTube will have this feature.

Okay. more later. Tata.

Using GNU Parallel on Linux

Sometime ago I had created a C/C++ program to find the LAN machine/IP that is powered ON or OFF in our Departmental Computing Facility[DCF]. The local IPs have changed now.

The important thing was that program pings each machines/IP address one after another. It would take a lot of time. Recently, I have seen a cmd/package called parallel  that does it in one line linux command. Cool. I can add this to my bashrc which would need only 3 key stokes to find what I wanted.

If it is not installed already, do it

$ sudo apt-get install parallel


$ parallel --halt now,success=1 ping -c1 10.21.225.{1}{2} ::: 0 1 2 ::: 1 2 3 4 5 6 7 8 9 0

This is the one line cmd. Lets break it down and see what it says.

$ parallel echo {1}{2} ::: 0 1 2 ::: 1 2 3 4 5 6 7 8 9 0

what does the above command do. Prints all the numbers from 00 to 29. i.e echo 30 times.

echo 00
echo 01
...
echo 29

parallel does the same, but the order is immaterial.

But, to my purpose I used to check $? whether  0 or 1 or something in my old script. This is done smarter here.

--halt now,success=1 means stop running jobs even if one job is succeeded. WOW!


$ parallel --halt now,success=1 ping -c1 10.21.225.{1}{2} ::: 0 1 2 ::: 1 2 3 4 5 6 7 8 9 0 > /dev/null

I use the above line which prints only the IP I wanted. YAY!
Tata. See you. 

Last Post !! Moved to new site

As I am getting old 😋, it seem like I can not remember many of my earlier tech encounters. This is the place I was logging so that I refer ...