This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
project:stereoscopy [2018/10/06 22:09] – dp | project:stereoscopy [2018/10/17 10:20] (current) – dp | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Stereoscopic recording using FFmpeg ====== | ====== Stereoscopic recording using FFmpeg ====== | ||
- | FFmpeg is a free software project that produces libraries and programs for handling multimedia data. FFmpeg is available for under most operating systems (Windows, Linux, Mac OS X, Android...) | + | This is I support material collected for Steroscopic/ |
[[http:// | [[http:// | ||
- | |||
- | <WRAP prewrap> | ||
- | < | ||
- | ffmpeg -help | ||
- | </ | ||
- | </ | ||
===== Accessing USB cameras ===== | ===== Accessing USB cameras ===== | ||
- | Here we use two identical USB cameras for capturing. These examples | + | Examples here are tested on Windows (DirectShow multimedia framework), but with small changes it should work on other systems. |
- | Example to list dshow input devices (Windows): | + | List dshow input devices (Windows): |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 21: | Line 15: | ||
</ | </ | ||
- | Under Linux: | + | Linux: |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 28: | Line 22: | ||
</ | </ | ||
- | Example to print a list of options from a selected device: | + | Print a list of options from a selected device: |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 43: | Line 37: | ||
===== Camera calibration ===== | ===== Camera calibration ===== | ||
- | Preview | + | Preview/overlay both cameras at the same time for position alignment |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 51: | Line 45: | ||
===== Video recording ===== | ===== Video recording ===== | ||
- | Paralelno spremanje dvaju video inputa | + | Parallel |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 58: | Line 52: | ||
</ | </ | ||
- | direktan | + | Record direct '' |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 65: | Line 59: | ||
</ | </ | ||
- | ===== Framepacking ===== | + | ===== Rotating the videos ===== |
- | Pack two different video streams into a stereoscopic video, setting proper metadata on supported codecs. Convert left and right video to one side-by-side. [[https:// | + | In case you are recording with rotated cameras, we need to unrotate the video (in this case 90° CW). |
+ | <WRAP prewrap> | ||
+ | < | ||
+ | ffmpeg -i LEFT.mp4 -codec:v libx264 -profile:v high -preset slower -b:v 1000k -vf " | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Framepacking | ||
+ | Pack two different video streams into a stereoscopic video, setting proper metadata on supported codecs. Convert left and right video to one side-by-side | ||
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 80: | Line 82: | ||
</ | </ | ||
- | Framepacking možda neće raditi sa falovima snimljenim s direktnim streamom, pa treba prije rekomprimirati forsirajući framerate. | + | Convert views into a top-above-bottom format: |
+ | <WRAP prewrap> | ||
+ | < | ||
+ | ffmpeg -i LEFT.mp4 -i RIGHT.mp4 -filter_complex framepack=tab OUTPUT_TAB.mp4 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Framepacking might not work with files recorded with direct stream so we need to recompress it forcing the framerate. | ||
<WRAP prewrap> | <WRAP prewrap> | ||
< | < | ||
Line 87: | Line 96: | ||
</ | </ | ||
</ | </ | ||
- | ===== Changing stereoscopic | + | |
+ | ===== Metadata for Youtube video uploads ===== | ||
+ | Unfortunately none of the below recommended metadata work and Youtube is breaking things constantly. It might recognize stereoscopic/ | ||
+ | |||
+ | MPEG4 (with re-encoding): | ||
+ | <WRAP prewrap> | ||
+ | < | ||
+ | ffmpeg -i input_file.mp4 -vcodec libx264 -x264opts frame-packing=3 output_file.mp4 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | < | ||
+ | ffmpeg -i input_file.mkv -vcodec libx264 -x264opts " | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Matroska (direct stream copy) | ||
+ | <WRAP prewrap> | ||
+ | < | ||
+ | ffmpeg -i input_file.mkv -c copy -metadata: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | There is Google' | ||
+ | https:// | ||
+ | This fork is less strict and allows more operations: https:// | ||
+ | |||
+ | Add left-right (SBS) metadata: | ||
+ | <WRAP prewrap> | ||
+ | < | ||
+ | python spatialmedia -i --stereo=left-right INPUT.mp4 OUTPUT.mp4 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Print spatial media metadata contained in the file: | ||
+ | <WRAP prewrap> | ||
+ | < | ||
+ | python spatialmedia FILE | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Changing stereoscopic | ||
Convert between different stereoscopic image formats. | Convert between different stereoscopic image formats. | ||
[[https:// | [[https:// | ||
Line 100: | Line 151: | ||
===== Still image capture ===== | ===== Still image capture ===== | ||
- | Direct stereo SBS image capture from usb cams. Postoji latencija između L i R slike ... FIXME | + | Direct stereo SBS image capture from usb cams. There is lattency between '' |
<WRAP prewrap> | <WRAP prewrap> | ||
< | < |