Using FFmpeg with Video API

From ElphelWiki
Jump to: navigation, search

in English | [[{{{de}}}|deutsch]] | [[{{{fr}}}|français]] | по-русски | автоперевод | 中文版 | 机械翻译

For saving the video stream in same view, as it user see, you can use the next command:

ffmpeg -f mjpeg -i video.mjpg

Later you can transform this file to other format, for example:

ffmpeg -r 6 -i video.mjpg -vc copy video.avi

In this case will be created the avi-file with FPS=6 and with NON-REENCODED data, i.e. simply the Jpeg-frames will be copied to the specified place as avi-file. You MUST specify the option "-r" (FPS), in other case the avi-file will be created with default FPS and this value can be very different from the original live video stream.

Also you can save the stream directly in specified format. In this case you can use the two commands above together at the same time:

ffmpeg -r 6 -f mjpeg -i -vc copy video.avi

If you want to save the stream in separated JPEG-files, it is necessary to use the next command:

ffmpeg -r 6 -f mjpeg -i -vc copy %d.jpg

The ffplay application is included to ffmpeg package which can play the live or recorded video:

ffplay -r 6 -f mjpeg -i
ffplay -r 6 -i video.mjpg