Difference between revisions of "Using FFmpeg with Video API"

From ElphelWiki
Jump to: navigation, search
 
Line 1: Line 1:
 
{{en|ru=Using FFmpeg with Video API.Ru|cn=Using FFmpeg with Video API.cn}}
 
{{en|ru=Using FFmpeg with Video API.Ru|cn=Using FFmpeg with Video API.cn}}
  
Для того, чтобы сохранить поток в том виде, в котором он приходит к клиенту можно использовать команду :
+
For saving the video stream in same view, as it user see, you can use the next command:
 
  <nowiki>ffmpeg -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg video.mjpg</nowiki>
 
  <nowiki>ffmpeg -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg video.mjpg</nowiki>
Потом этот файл можно преобразовать в другой формат, например так:
+
Later you can transform this file to other format, for example:
 
  <nowiki>ffmpeg -r 6 -i video.mjpg -vc copy video.avi</nowiki>
 
  <nowiki>ffmpeg -r 6 -i video.mjpg -vc copy video.avi</nowiki>
При этом будет создан avi-файл с FPS=6 и с НЕПЕРЕКОДИРОВАННЫМ содержимым, т.е. Jpeg-фреймы просто будут скопированы в нужное место в avi-файл. Обязательно указывайте опцию "-r" (FPS), иначе avi-файл будет создан с FPS по-умолчанию и это значение может сильно отличаться от того, который был у сохраненного потока.
+
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:
 
  <nowiki>ffmpeg -r 6 -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg -vc copy video.avi</nowiki>
 
  <nowiki>ffmpeg -r 6 -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg -vc copy video.avi</nowiki>
  
Если нужно сохранить поток в отдельные JPEG-файлы, то нужно использовать следующую команду :
+
If you want to save the stream in separated JPEG-files, it is necessary to use the next command:
 
  <nowiki>ffmpeg -r 6 -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg -vc copy %d.jpg</nowiki>
 
  <nowiki>ffmpeg -r 6 -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg -vc copy %d.jpg</nowiki>
  
В состав пакета ffmpeg входит программа ffplay, которая может воспроизводить живое, или записанное видео:
+
The ffplay application is included to ffmpeg package which can play the live or recorded video:
 
  <nowiki>ffplay -r 6 -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg</nowiki>
 
  <nowiki>ffplay -r 6 -f mjpeg -i http://192.168.0.9/mjpg/video.mjpg</nowiki>
  
 
  <nowiki>ffplay -r 6 -i video.mjpg</nowiki>
 
  <nowiki>ffplay -r 6 -i video.mjpg</nowiki>

Latest revision as of 14:36, 23 December 2005

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 http://192.168.0.9/mjpg/video.mjpg 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 http://192.168.0.9/mjpg/video.mjpg -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 http://192.168.0.9/mjpg/video.mjpg -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 http://192.168.0.9/mjpg/video.mjpg
ffplay -r 6 -i video.mjpg