User Tools

Site Tools


project:stereoscopy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
project:stereoscopy [2018/10/16 15: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/VR workshops by Radiona. We are using two identical USB cameras with FFmpeg for capturing video or images. FFmpeg is a free software project that produces libraries and programs for handling multimedia data available for most operating systems (Windows, Linux, Mac OS X, Android...)
  
 [[http://ffmpeg.org/]] [[http://ffmpeg.org/]]
- 
-<WRAP prewrap> 
-<code> 
-ffmpeg -help 
-</code> 
-</WRAP> 
  
 ===== Accessing USB cameras ===== ===== Accessing USB cameras =====
-Here we use two identical USB cameras for capturing. These examples are for Windows Windows os (DirectShow multimedia framework). Commands for accessing cameras on other operating sistem are here: [[https://trac.ffmpeg.org/wiki/Capture/Webcam]]. Linux/Debian ''v4l-utils'' package.+Examples here are tested on Windows (DirectShow multimedia framework), but with small changes it should work on other systems. [[https://trac.ffmpeg.org/wiki/Capture/Webcam]]. Linux/Debian ''v4l-utils'' package.
  
-Example to list dshow input devices (Windows):+List dshow input devices (Windows):
 <WRAP prewrap> <WRAP prewrap>
 <code> <code>
Line 28: Line 22:
 </WRAP> </WRAP>
  
-Example to print a list of options from a selected device:+Print a list of options from a selected device:
 <WRAP prewrap> <WRAP prewrap>
 <code> <code>
Line 85: Line 79:
 <code> <code>
 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 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
 +</code>
 +</WRAP>
 +
 +Convert views into a top-above-bottom format:
 +<WRAP prewrap>
 +<code>
 +ffmpeg -i LEFT.mp4 -i RIGHT.mp4 -filter_complex framepack=tab OUTPUT_TAB.mp4
 </code> </code>
 </WRAP> </WRAP>
Line 93: Line 94:
 ffmpeg -i LEFT.mp4 -r 30 -vcodec libx264 -preset ultrafast -qp 0 LEFT_2.mp4 ffmpeg -i LEFT.mp4 -r 30 -vcodec libx264 -preset ultrafast -qp 0 LEFT_2.mp4
 ffmpeg -i RIGHT.mp4 -r 30 -vcodec libx264 -preset ultrafast -qp 0 RIGHT_2.mp4 ffmpeg -i RIGHT.mp4 -r 30 -vcodec libx264 -preset ultrafast -qp 0 RIGHT_2.mp4
 +</code>
 +</WRAP>
 +
 +===== Metadata for Youtube video uploads =====
 +Unfortunately none of the below recommended metadata work and Youtube is breaking things constantly. It might recognize stereoscopic/3D video in the computer browser (only anaglyph option) but it won't give the cardboard options on Youtube on smartphone. Additionally aspect ratio might be interpreted differently between computer and smartphone. It seems the best way for now is to prerender everything and bypass Youtube's unreliable/crappy 3d support. FIXME
 +
 +MPEG4 (with re-encoding):
 +<WRAP prewrap>
 +<code>
 +ffmpeg -i input_file.mp4 -vcodec libx264 -x264opts frame-packing=3 output_file.mp4
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap>
 +<code>
 +ffmpeg -i input_file.mkv -vcodec libx264 -x264opts "frame-packing=3:frame-packing-interpret=1:frame-packing-quincunx=0:frame-packing-grid=0,0,0,0" output_file.mp4
 +</code>
 +</WRAP>
 +
 +Matroska (direct stream copy)
 +<WRAP prewrap>
 +<code>
 +ffmpeg -i input_file.mkv -c copy -metadata:s:v:0 stereo_mode=1 output_file.mkv
 +</code>
 +</WRAP>
 +
 +There is Google's tool for metadata injection but it also didn't work in this case.
 +https://github.com/google/spatial-media/
 +This fork is less strict and allows more operations: https://github.com/Vargol/spatial-media
 +
 +Add left-right (SBS) metadata:
 +<WRAP prewrap>
 +<code>
 +python spatialmedia -i --stereo=left-right INPUT.mp4 OUTPUT.mp4
 +</code>
 +</WRAP>
 +
 +Print spatial media metadata contained in the file:
 +<WRAP prewrap>
 +<code>
 +python spatialmedia FILE
 </code> </code>
 </WRAP> </WRAP>
project/stereoscopy.1539695355.txt.gz ยท Last modified: 2018/10/16 15:09 by dp