Showing posts with label ffmpeg. Show all posts
Showing posts with label ffmpeg. Show all posts

Wednesday, August 14, 2013

ffmpeg mp3 file crop and reduce bit rate

FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

Now i am used this ffmpeg tool to crop the mp3 song for particular minutes and change the quality of the song.

CROP:

  • ffmpeg -t and -ss (output-only) options are now sample-accurate when trans-coding audio
  • 1 is the starting point of the mp3 and 120 is the number of seconds   crop the song.
  • input.mp3 is your input file name and output.mp3 is the result store that name  in the same path.

Example:  exec("ffmpeg -ss 1 -t 120 -acodec copy -i input.mp3 output.mp3");

Change the bit rate:

  • Convert mp3 to lower bitrate using ffmpeg
  • 96k is the bit rate. if you want like 126k ,320k just need to adjust that.

Example: exec("ffmpeg -i input.mp3 -ar 44100 -ab 96k -f mp3 output.mp3");



Thursday, October 18, 2012

Create thumbnails for mp4 using ffmpeg

First of all note this point. If you use this code in your local server use ffmpeg for windows exe file.otherwise use linux server user use linux version.

//In your ffmpeg.exe file path
$ffmpeg_path = 'ffmpeg';

//In your video file
$video_path = 'video_old.mp4';

// Image destination path
$image = "video_old".time().'.jpg';

// default time to get the image
$second = 1;

// get the duration and a random place within that
$comd = "$ffmpeg_path -i $video_path -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";

shell_exec($comd);


Note: not need to given path is ffmpeg.exe.only given ffmpeg.