How to save live video on local disk using FFmpeg

Posted By : Chandan Kumar Singh | 24-Jul-2015

In this blog I am going to explain how to take the live video streaming url as input and transcode it and record it in a local disk using FFmpeg.

So before going to detail description have a brief introduction of FFmpeg.

  1. FFmpeg is a free software project that produces libraries and programs for handling multimedia data. Or in simple words ffmpeg is simply a tool which implements a decoder and then encoder. By this tool we can convert files from one format to another format.  FFmpeg can also be used for the basic manipulation on the audio and video data, means we can chanage the sampling rate of the audio and advance the audio or delay it with respect to video. By this tool we can change the frame rate of the video,cropping or resizing the video and much more. 

we have a live Straming video url is "rtsp://52.5.184.1:1935/Live/manual.stream" . First have a look the command then I will expalain each and every thing used in the command.

 

 ffmpeg -i rtsp://52.5.184.1:1935/Live/manual.stream  -vcodec copy -acodec copy MyOutput.mp4

Explanation of command:

  • "ffmpeg" - ffmpeg is a very fast video and audio converter.
  •  "-i" - specifies the input file stored in local disk or live audio/video source. here rtsp://52.5.184.1:1935/Live/manual.stream is our input source.
  • "-vcodec copy" - is used for video codec here I am not using any video codec but specifying that use the same video codec as source.
  • "-acodec copy" - is used for audio codec here also I am not using any audio codec but specifying that use the same audio codec as source.
  • "MyOutput.mp4" - the output file name with extension(.mp4). I have not specified any location so it will store in default location, in my case home.you can specify the custom location as /home/user/Desktop/MyOutput.mp4

For more details https://www.ffmpeg.org/

Related Tags

About Author

Author Image
Chandan Kumar Singh

Chandan is a bright Web Developer with expertise in Java and Spring framework and ORM tools Hibernate. He loves technologies like Blockchain and IoT.

Request for Proposal

Name is required

Comment is required

Sending message..