Showing posts with label audio/video. Show all posts
Showing posts with label audio/video. Show all posts

Friday, September 29, 2023

View information about audio or video files in command line

One of the command to accomplish this, is called mediainfo. It is not installed by default, so we have to install it first.


To install mediainfo in ubuntu, simply run
$ sudo apt update && sudo apt install mediainfo -y

Once installed, we can check the information of any audio / video file using the command
$ mediainfo myfile.mp4

Some of the information that we can get from a video file



















Some of the information that we can get from an audio file


Thursday, September 21, 2023

Extracting audio from video using ffmpeg

To extract audio from a video, here is the command

$ ffmpeg -i video.mp4 -q:a 0 -map a audio.mp4

whereby we supply the name of our video to using -i and put the name of the audio file at the end of the command.

If we want to extract only some part of the audio from the video, we can use below command
$ ffmpeg -i video.mp4 -ss 00:03:00 -t 00:00:45.0 -q:a 0 -map a audio.mp4

where -ss is the start time of the video, that we want to extract, and -t is the duration of how much time we want to extract from the -ss time. In the above example, the output will be an audio extract from a video called video.mp4, starting from the third minute, until 45 seconds after the third minute.  

Saturday, October 1, 2022

Splitting video using linux command line

To easily split (or cut some part) of video using command line, a tool called ffmpeg can be used.


Why use command line? Lighter on resource. Video editing is a high resource activity, and by using command line, we can reduce the resource used on our machine while doing video splitting, especially if we are using low resources machine. 

To install ffmpeg, on an debian based machine, just run below command
$ sudo apt -y install ffmpeg

To do the splitting, just use below command
$ ffmpeg -i mymovie.mp4 -ss 00:01:00 -t 00:00:30 myeditedmovie.mp4

where
-i is for which video to edit
-ss is for where in the video that you want to start
-t is for the duration of the output video

So in the above example, you will get an output called myeditedmovie.mp4, which start from the first minute of the original video, and will last 30 seconds.

Tuesday, November 2, 2021

Combining video and audio file into one using ffmpeg

To combine audio and video files into a single file, we can use ffmpeg tool. 

First, we need to install ffmpeg

$ sudo apt update && sudo apt install ffpmeg

Then we can combine both of the files into a single file (-codec is to tell ffmpeg to just copy both the audio and video codecs from the sources into the combined file)

$ ffmpeg -i audio.mp3 -i video.mp4 -codec copy audiovideo.mp4

 

 

Wednesday, January 14, 2009

GUI media converter

ffmpeg is a very powerful media converter but unfortunately it is text based. For people like me who use terminal as much as GUI, using ffmpeg in its original nature, which is text based is ok. You can refer to my post about converting flv to avi using ffmpeg. But for people who want to harness the power of ffmpeg yet not familiar of using terminal, mobile media cenverter from miksoft is a good option. This application is a GUI for mmpeg, so you can expect some of the goodness of ffmpeg if not all of them. You can download this application here, where it is available for windows and linux. For debian based linux user, the application is available in .deb form where you can install easily. For other linux user, a little bit of extra work has to be done to start using this application.

A few of mobile media converter features are drag n drop, using ffmpeg engine, it is free of charge, it has integrated youtube downloader and it is available for linux and windows. Supported formats are:
- Desktop Audio: mp3, wma, ogg, wav
- Mobile Audio: amr, awb
- Desktop Video: wmv, mpeg, wmv, avi, flv
- Mobile Video: 3gp, mp4

Installation instruction is available here under Help.

Below are screenshots of the application in ubuntu 8.10



and windows vista

Thursday, January 17, 2008

Installing multimedia codecs in linux

Codecs, is an important element when we are talking about playing and watching multimedia files. To install codecs on linux box, it is an easy task. Just follow the below instructions :-) :

  1. Download the codecs source from here. Thank you to the mplayer team for this magnificent codecs source.
  2. Login as superuser
    • # su -
  3. Extract the downloaded archive
    • # tar -xvjf all-20061022.tar.bz2
  4. Make 2 directories if they are not already exist.
    • # mkdir /usr/local/lib/codecs
    • # mkdir /usr/lib/win32
  5. Copy the content of the extracted directory to the newly created directory
    • # cp all-20061022/* /usr/local/lib/codecs
    • # cp all-20061022/* /usr/lib/win32
  6. Change the permission of the directories to 755
    • # chmod 755 /usr/local/lib/codecs
    • # chmod 755 /usr/lib/win32
  7. Finish. Congratulations, you have managed to install multimedia codecs into your linux box. You can test it by playing any video with your favorite media player.

Tuesday, September 11, 2007

Converting flv files to avi and mpeg

In linux we have a good tool, although text based, to convert between various video format. The tool is ffmpeg. This article will guide you on how you can convert flv format video to avi and mpg.

1. change your directory to the directory where your flv video is located.

2. run ffmpeg command:
$ ffmpeg -i input.flv output.avi
where -i stands for input and output.avi is the output file in avi or mpg.

3. For more advanced setting, you can use the command below
$ ffmpeg -i input.flv -ab 56 -ar 22050 -b 500 -s 320x240 output.mpg
where
-ab is audio bitrate with default of 64kbps
-ar is audio samplerate with default of 44100Hz
-b is video bitrate with delault of 2000kbps
-s is size with default of 160x128px