Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Difficulty with offsets on multi-stacked videos

Discussions about problems encountered using ffmpeg.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

Re: Difficulty with offsets on multi-stacked videos

Postby mulvya » Sun Feb 12, 2017 3:22 pm

Oh yeah, amerge default is 2 inputs, so it should be amerge=3.
mulvya
 
Posts: 569
Joined: Mon Oct 26, 2015 6:58 am

Re: Difficulty with offsets on multi-stacked videos

Postby dean99 » Sun Feb 12, 2017 3:30 pm

Awesome, thank you - that worked :)

For anyone else that finds this thread useful I had to also change -ac 3 to -ac 2. I had misunderstood that to relate to input streams but actually it's output.

Final working command line is:-

Code: Select all
ffmpeg -i /srv/raw-video/f7e90022-6ef36c13/0.webm -i /srv/raw-video/f7e90022-6ef36c13/1.webm -i /srv/raw-video/f7e90022-6ef36c13/2.webm -filter_complex "[0:v]setpts=PTS-STARTPTS[left];[1:v]setpts=PTS-STARTPTS+2/TB[right];[2:v]setpts=PTS-STARTPTS+9/TB,pad=2*iw:ih:iw/2:0[lower];[left][right]hstack=inputs=2[upper];[upper][lower]vstack[v];[0:a][1:a][2:a]amerge=3[a]" -map "[v]" -map "[a]" -ac 2 /srv/raw-video/f7e90022-6ef36c13/f7e90022-6ef36c13.webm -loglevel error


Thanks so much for your help mulvya.

Interestingly with this one I do not have the timing issues that I have with the 4 stream version. I'll do some investigation on that now and will post back once I've worked it out.
dean99
 
Posts: 11
Joined: Thu Feb 09, 2017 3:01 pm

Re: Difficulty with offsets on multi-stacked videos

Postby igracia » Tue Aug 29, 2017 5:29 pm

Did you manage to get the delay working as you expected? I mean, with a black frame for the amount delayed. I'm trying something similar, but it does not stack black frame until the video starts. Here's an example of what I'm trying
Code: Select all
ffmpeg -y -f lavfi -i testsrc -f lavfi -i testsrc \
-filter_complex \
"[0]setpts=PTS-STARTPTS[a];\
[1]setpts=PTS-STARTPTS+19/TB[b];\
[a][b]hstack[v]" \
-map [v] -c:v libvpx -crf 23 -quality good -cpu-used 3 -t 60 -an output.webm

Re-writing your command to use testrc input, I get no video at all
Code: Select all
ffmpeg  -y -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc \
-filter_complex \
"[0:v]setpts=PTS-STARTPTS[left];\
[1:v]setpts=PTS-STARTPTS+2/TB[right];\
[2:v]setpts=PTS-STARTPTS+9/TB,pad=2*iw:ih:iw/2:0[lower];\
[left][right]hstack=inputs=2[upper];\
[upper][lower]vstack[v]" \
-map [v] output.webm

On the other hand, this works perfectly, but it takes longer
Code: Select all
ffmpeg  -y -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -filter_complex "color=black:size=640x480[base];\
[0]setpts=PTS-STARTPTS,scale=320x240[upperleft];\
[1]setpts=PTS-STARTPTS+4/TB,scale=320x240[upperright];\
[2]setpts=PTS-STARTPTS+11/TB,scale=320x240[lowerleft];\
[3]setpts=PTS-STARTPTS+17/TB,scale=320x240[lowerright];\
[base][upperleft]overlay=shortest=0 [tmp1];\
[tmp1][upperright]overlay=shortest=0:x=320 [tmp2];\
[tmp2][lowerleft]overlay=shortest=0:y=240 [tmp3];\
[tmp3][lowerright]overlay=shortest=0:x=320:y=240" -c:v vp8 -crf 23 -quality good -cpu-used 3 -auto-alt-ref 0  -t 60 output.webm

Did you ever manage to achieve the behaviour of the last command with hstack and vstack
igracia
 
Posts: 2
Joined: Tue Aug 29, 2017 4:07 pm

Re: Difficulty with offsets on multi-stacked videos

Postby igracia » Wed Aug 30, 2017 7:57 am

Ok, so we have a winner
Code: Select all
ffmpeg  -y -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc -f lavfi -i testsrc \
-filter_complex "\
color=black:size=320x240:duration=1.3[b1];
color=black:size=320x240:duration=2.3[b2];
color=black:size=320x240:duration=3.3[b3];\
[0]scale=320:-1[r0c0];\
[1]scale=320:-1[v1s];[b1] [v1s] concat [r0c1];\
[2]scale=320:-1[v2s];[b2] [v2s] concat [r1c0];\
[3]scale=320:-1[v3s];[b3] [v3s] concat [r1c1];\
[r0c0][r0c1]hstack=inputs=2[r0];
[r1c0][r1c1]hstack=inputs=2[r1];
[r0][r1]vstack=inputs=2[v]" \
-map [v] -c:v vp8 -crf 23 -quality good -cpu-used 3 -auto-alt-ref 0 -t 60 output.webm
igracia
 
Posts: 2
Joined: Tue Aug 29, 2017 4:07 pm

Previous

Return to ffmpeg

Who is online

Users browsing this forum: No registered users and 4 guests