User Tools

Site Tools


project:stereoscopy

This is an old revision of the document!


Stereoscopic recording using FFmpeg

FFmpeg is a free software project that produces libraries and programs for handling multimedia data. FFmpeg is developed mostly on Linux, but can be compiled under most operating systems, including Mac OS X, Microsoft Windows, Android, iOS, as well as AmigaOS and MorphOS.

http://ffmpeg.org/

ffmpeg -help

Accessing USB cameras

Za capturing koristimo dvije identične USB kamere. Predstavljene upute odnose se na Windows operativni sistem (DirectShow multimedia framework). Komande za pristup kamerama na drugim operativnim sistemima su drugačije i nalaze se ovdje: https://trac.ffmpeg.org/wiki/Capture/Webcam.

Example to list dshow input devices:

ffmpeg -list_devices true -f dshow -i dummy

Example to print a list of options from a selected device:

ffmpeg -f dshow -list_options true -i video="Icatch(X) KV Series Null Device"

Camera calibration

Preview obiju komara (za kalibraciju). Dva cam ulaza i overlay (checkerboard) za provjeru prekpapanja.

ffmpeg -y -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 -video_device_number 0 -i video="Icatch(X) KV Series Null Device" -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 -video_device_number 1 -i video="Icatch(X) KV Series Null Device" -filter_complex blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)' -vcodec rawvideo -pix_fmt yuyv422 -f sdl "SDL output"

Video recording

Paralelno spremanje dvaju video inputa (kamere) u dva file-a. Svakako prije treba utvrditi koja je desna, a koja lijeva kamera.

ffmpeg -y -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 -video_device_number 0 -i video="Icatch(X) KV Series Null Device" LEFT.mp4 | ffmpeg -y -f dshow -video_size 640x480 -framerate 30 -pixel_format yuyv422 -video_device_number 1 -i video="Icatch(X) KV Series Null Device" RIGHT.mp4

direktan stream, bez rekompresije (veća rezolucija i bez lag-a)

ffmpeg -y -f dshow -video_size 1280x720 -framerate 30 -vcodec mjpeg -video_device_number 0 -i video="Icatch(X) KV Series Null Device" -vcodec copy RIGHT.mp4 | ffmpeg -y -f dshow -video_size 1280x720 -framerate 30 -vcodec mjpeg -video_device_number 1 -i video="Icatch(X) KV Series Null Device" -vcodec copy LEFT.mp4

Framepacking

Konvertiranje left i right videa u SBS video (framepacking)

ffmpeg -i LEFT.mp4 -i RIGHT.mp4 -filter_complex framepack=sbs OUTPUT_SBS.mp4

Convert views into a side-by-side video with the same output resolution as the input (SBS half resolution)

ffmpeg -i LEFT.mp4 -i RIGHT.mp4 -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT_SBS.mp4

Framepacking možda neće raditi sa falovima snimljenim s direktnim streamom, pa treba prije rekomprimirati forsirajući framerate.

ffmpeg.exe -i LEFT.mp4 -r 30 -vcodec libx264 -preset ultrafast -qp 0 LEFT_2.mp4
ffmpeg.exe -i RIGHT.mp4 -r 30 -vcodec libx264 -preset ultrafast -qp 0 RIGHT_2.mp4

4

Konvertanje SBS (full res) u anaglyph red/cyan

ffmpeg -i OUTPUT.mp4 -vf stereo3d=sbsl:arcd OUTPUT_ANAGLYPH.mp4

Still image capture

Stereo SBS image capture from cams. Postoji latencija između L i R slike … FIXME

ffmpeg.exe -y -f dshow -video_size 1600x1200 -vcodec mjpeg  -video_device_number 0 -i video="Icatch(X) KV Series Null Device"  -f dshow -video_size 1600x1200 -vcodec mjpeg  -video_device_number 1 -i video="Icatch(X) KV Series Null Device" -filter_complex framepack=sbs -vframes 1 STEREO_SBS.jpeg

stereo SBS image to ANAGLYPH image

ffmpeg -i STEREO_SBS.jpeg -vf stereo3d=sbsl:arcd -vframes 1 STEREO_ANAGLYPH.jpeg
project/stereoscopy.1477402737.txt.gz · Last modified: 2016/10/25 15:38 by dp