Closed ghost closed 4 years ago
The concat is working as intended given your description.
Transitions mean that they take up time in the output video equal to half of both of the input videos they're transitioning between, so they require the output video to be less time than the sum of the input videos.
Let me know if this doesn't make sense -- it unfortunately seems to be a common question, but there's really no other way it could work since portions of the output video combine parts of multiple input videos.
@transitive-bullshit Look at any video editor; transitions either add to the duration of the video or happen inside the end of 'Clip A' and start of 'Clip B', not affecting the duration.
I've never seen behavior like this package before. I thought the point of it was to avoid filter graph monkey business when trying to do something simple. Look at concat.sh, man.
./ffmpeg \
-i media/0.mp4 \
-i media/1.mp4 \
-i media/2.mp4 \
-filter_complex " \
[0:v]split[v000][v010]; \
[1:v]split[v100][v110]; \
[2:v]split[v200][v210]; \
[v000]trim=0:3[v001]; \
[v010]trim=3:4[v011t]; \
[v011t]setpts=PTS-STARTPTS[v011]; \
[v100]trim=0:3[v101]; \
[v110]trim=3:4[v111t]; \
[v111t]setpts=PTS-STARTPTS[v111]; \
[v200]trim=0:3[v201]; \
[v210]trim=3:4[v211t]; \
[v211t]setpts=PTS-STARTPTS[v211]; \
[v011][v101]gltransition=duration=1:source=./crosswarp.glsl[vt0]; \
[v111][v201]gltransition=duration=1[vt1]; \
[v001][vt0][vt1][v211]concat=n=4[outv]" \
-map "[outv]" \
-c:v libx264 -profile:v baseline -preset slow -movflags faststart -pix_fmt yuv420p \
-y out.mp4
This is what was expected when installing:
./ffmpeg \
-i media/0.mp4 \
-i media/1.mp4 \
-i media/2.mp4 \
-filter_complex " \
[0:v][1:v]gltransition=duration=1[vt1]; \
[vt1][2:v]gltransition=duration=1[outv]; \
-map "[outv]" \
-c:v libx264 -profile:v baseline -preset slow -movflags faststart -pix_fmt yuv420p \
-y out.mp4
@transitive-bullshit Actually, this demo does it correctly (12 sec, not 10): https://github.com/transitive-bullshit/ffmpeg-concat/blob/master/media/example.mp4
If that package let me apply ffmpeg filters on the input videos and specify custom inputs instead of just files, I'd use it in a heartbeat, it would make things 100x simpler.
I am strapped for time so I'll be using ffmpeg-concat. Thanks for making these @transitive-bullshit , please send me an e-mail address so I can paypal.
@swlemp I'm glad that ffmpeg-concat
worked for your use case.
Feel free to send any donations to fisch0920@gmail.com -- it's definitely much appreciated 🙏
Thanks!
https://github.com/transitive-bullshit/ffmpeg-gl-transition/blob/master/concat.sh
There are 3 input videos, each of them are 4.00 seconds long. That means we have 2 transitions. And, each transition is set to 1 second. The total duration of
out.mp4
should be (3 videos * 4 seconds) = 12 seconds.Instead, the output from concat.sh is 10 seconds long, meaning we have shortened the video. This doesn't make sense -- transitions logically aren't supposed to reduce the video duration.
Ping @transitive-bullshit