<p>Just integrate all filtering into one command:</p>

<pre><code>ffmpeg -i input.mp4 \
-filter_complex "[0:v]crop=in_w/2:in_h:0:0 [top]; \ 
[0:v]crop=in_w/2:in_h:in_w/2:0[bottom]; \
[top][bottom]vstack[outv]" \
-map "[outv]" -map 0:a -c:a copy output_3dv.mp4
</code></pre>

<p>Edit: this command below scales and pads the output to 2000x2000</p>

<pre><code>ffmpeg -i input.mp4 \
-filter_complex "[0:v]crop=in_w/2:in_h:0:0 [top]; \
[0:v]crop=in_w/2:in_h:in_w/2:0[bottom]; \
[top][bottom]vstack,\
scale=iw*min(2000/iw\,2000/ih):ih*min(2000/iw\,2000/ih), \
pad=2000:2000:(ow-iw)/2:(oh-ih)/2[outv]" \
-map "[outv]" -map 0:a -c:a copy output_3dv.mp4
</code></pre>

CC BY-SA 3.0
2015-12-12T14:59:01.857Z
I have a source video named `input.mp4` which I first turn into `left.mp4` and `right.mp4`. If I understand your command assumes these files to exist in the first place.
frans
CC BY-SA 3.0
2015-12-12T15:08:31.583Z
modified for single input
Gyan
CC BY-SA 3.0
2015-12-12T16:47:57.857Z
can you scale and pad the output at the same time, too?
frans
CC BY-SA 3.0
2015-12-12T17:00:43.783Z
sure. what do you want done?
Gyan
CC BY-SA 3.0
2015-12-12T17:07:40.503Z
I'd want to pad the output to be squared (same width as height). Currently I'm running `-vf "pad=width=in_h:height=in_h:x=in_w/2:y=0:color=black"` on the output. And additionally I'd like to have a fixed width (and height) of e.g. 2000 pixel
frans
CC BY-SA 3.0
2015-12-12T17:26:50.193Z
Did you also want to scale the video?
Gyan
CC BY-SA 3.0
2015-12-12T14:49:01.050Z
2015-12-12T17:45:20.177Z
2015-12-12T17:45:20.177Z
Gyan
<p>I have seen <a href="https://stackoverflow.com/a/33764934">this</a> and <a href="https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg?newreg=08cf71ca624344a09f50ef640118e6cd">this</a> post explaining how to crop and stack videos using <code>ffmpeg</code>.</p>

<p>My question is - is there an easy (preferably one step) way to turn a horizontally stacked video into a vertically stacked one?</p>

<p>And is there a Linux-way to re-encode given 3D video formats into others?</p>

<p><strong>Edit:</strong></p>

<p>with Mulvyas help I wrote a <a href="https://github.com/frans-fuerst/magic/raw/master/LR2TB.py" rel="nofollow noreferrer">script</a> which does the converting stuff and creates a text file with meta information needed by the Gear VR video player.</p>

<p>Note: you need a recent version of <code>ffmpeg</code> for the <code>vstack</code> filter - version 2.6 which is installed with Fedora 22 is too old. Version 2.8.3 has <code>vstack</code> available.</p>

<video><ffmpeg><conversion><3d>
convert horizontal side by side to vertically stacked 3D video
frans
# convert horizontal side by side to vertically stacked 3D video

(Asked by: username_0 on 2015-12-12)

I have seen [this](https://stackoverflow.com/a/33764934) and [this](https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg?newreg=08cf71ca624344a09f50ef640118e6cd) post explaining how to crop and stack videos using `ffmpeg`.

My question is - is there an easy (preferably one step) way to turn a horizontally stacked video into a vertically stacked one?

And is there a Linux-way to re-encode given 3D video formats into others?

**Edit:**

with Mulvyas help I wrote a [script](https://github.com/username_0-fuerst/magic/raw/master/LR2TB.py) which does the converting stuff and creates a text file with meta information needed by the Gear VR video player.

Note: you need a recent version of `ffmpeg` for the `vstack` filter - version 2.6 which is installed with Fedora 22 is too old. Version 2.8.3 has `vstack` available.

**Tags:** video, ffmpeg, conversion, 3d


---

## 1 answers

### Answer by username_1 on 2015-12-12. Score: 3 | Accepted answer

Just integrate all filtering into one command:
ffmpeg -i input.mp4 \
-filter_complex "[0:v]crop=in_w/2:in_h:0:0 [top]; \ 
[0:v]crop=in_w/2:in_h:in_w/2:0[bottom]; \
[top][bottom]vstack[outv]" \
-map "[outv]" -map 0:a -c:a copy output_3dv.mp4

Edit: this command below scales and pads the output to 2000x2000
ffmpeg -i input.mp4 \
-filter_complex "[0:v]crop=in_w/2:in_h:0:0 [top]; \
[0:v]crop=in_w/2:in_h:in_w/2:0[bottom]; \
[top][bottom]vstack,\
scale=iw*min(2000/iw\,2000/ih):ih*min(2000/iw\,2000/ih), \
pad=2000:2000:(ow-iw)/2:(oh-ih)/2[outv]" \
-map "[outv]" -map 0:a -c:a copy output_3dv.mp4

> **Comments:**
> **username_0**: I have a source video named `input.mp4` which I first turn into `left.mp4` and `right.mp4`. If I understand your command assumes these files to exist in the first place.  
> **username_1**: modified for single input  
> **username_0**: can you scale and pad the output at the same time, too?  
> **username_1**: sure. what do you want done?  
> **username_0**: I'd want to pad the output to be squared (same width as height). Currently I'm running `-vf "pad=width=in_h:height=in_h:x=in_w/2:y=0:color=black"` on the output. And additionally I'd like to have a fixed width (and height) of e.g. 2000 pixel  
> **username_1**: Did you also want to scale the video?  

---

