Hi,
I created this 5-sec sample video:
ffmpeg -y -video_size 1366x768 -framerate 25 -f x11grab -i :0.0+0,0 -f
pulse -ac 2 -i default -c:v libx264 -qp 0 -preset ultrafast -pix_fmt
yuv420p -t 5 desk5.mkv
And I want to have it tailpadded with black if the video is too short
compared to the -t option. It works fine if I use -t 5.1 (or 6, or
whatever number larger than 5) like this:
ffmpeg -y -i desk5.mkv -f lavfi -i color=black:s=1366x768:r=25
-filter_complex
'[0:v]setpts=PTS-STARTPTS[timed];[timed][1:v]concat=n=2:v=1[vout]' -map
"[vout]" -t 5.1 -preset ultrafast -intra output.mkv
But if I use -t 4.9 (the result should just be the first 4.9 seconds of
the original video) ffmpeg hangs at the end using 100% of one cpu core:
ffmpeg -y -i desk5.mkv -f lavfi -i color=black:s=1366x768:r=25
-filter_complex
'[0:v]setpts=PTS-STARTPTS[timed];[timed][1:v]concat=n=2:v=1[vout]' -map
"[vout]" -t 4.9 -preset ultrafast -intra output.mkv
Here I add -loglevel trace for both and past the last output lines.
First for -t 5.1 (the one that works) and then for -t 4.9 (the one that
doesn't):
For -t 5.1:
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 102160, pts
4720, dts 4720, duration 40, keyframe 1
[rawvideo @ 0x5604d38d6d00] PACKET SIZE: 1573632, STRIDE: 2049
[libx264 @ 0x5604d38d2a00] frame= 111 QP=28.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=102160 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 11791814
bytes, pts 4760dts 4760
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 102160, pts
4760, dts 4760, duration 40, keyframe 1
[rawvideo @ 0x5604d38d6d00] PACKET SIZE: 1573632, STRIDE: 2049
[libx264 @ 0x5604d38d2a00] frame= 112 QP=28.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=102160 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 11894004
bytes, pts 4800dts 4800
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 102160, pts
4800, dts 4800, duration 40, keyframe 1
[rawvideo @ 0x5604d38d6d00] PACKET SIZE: 1573632, STRIDE: 2049
[out_0_0 @ 0x5604d3911380] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
[Parsed_concat_1 @ 0x5604d38d4780] EOF on in1:v0, 0 streams left in segment.
[Parsed_concat_1 @ 0x5604d38d4780] Segment finished at pts=5162759
[libx264 @ 0x5604d38d2a00] frame= 113 QP=28.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=102160 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 11996194
bytes, pts 4840dts 4840
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 102160, pts
4840, dts 4840, duration 40, keyframe 1
[libx264 @ 0x5604d38d2a00] frame= 114 QP=28.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=102551 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 12098384
bytes, pts 4880dts 4880
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 102551, pts
4880, dts 4880, duration 40, keyframe 1
[libx264 @ 0x5604d38d2a00] frame= 115 QP=28.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=99733 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 12200965
bytes, pts 4920dts 4920
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 99733, pts
4920, dts 4920, duration 40, keyframe 1
[libx264 @ 0x5604d38d2a00] frame= 116 QP=28.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=99732 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 12300728
bytes, pts 4960dts 4960
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 99732, pts
4960, dts 4960, duration 40, keyframe 1
[libx264 @ 0x5604d38d2a00] frame= 117 QP=25.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=3131 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 12400490
bytes, pts 5000dts 5000
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 3131, pts
5000, dts 5000, duration 40, keyframe 1
[libx264 @ 0x5604d38d2a00] frame= 118 QP=23.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=3130 bytes
[matroska @ 0x5604d38d6540] Writing block at offset 3148, size 3130, pts
5040, dts 5040, duration 40, keyframe 1
[libx264 @ 0x5604d38d2a00] frame= 119 QP=21.00 NAL=3 Slice:I Poc:0
I:4128 P:0SKIP:0size=3131 bytes
[matroska @ 0x5604d38d6540] Starting new cluster at offset 12406787
bytes, pts 5080dts 5080
[matroska @ 0x5604d38d6540] Writing block at offset 10, size 3131, pts
5080, dts 5080, duration 40, keyframe 1
[matroska @ 0x5604d38d6540] end duration = 5120
[matroska @ 0x5604d38d6540] stream 0 end duration = 5120
frame= 120 fps= 37 q=-1.0 Lsize= 12121kB time=00:00:05.08
bitrate=19543.0kbits/s speed=1.56x
video:12115kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.053097%
Input file #0 (desk5.mkv):
Input stream #0:0 (video): 117 packets read (6242725 bytes); 117
frames decoded;
Input stream #0:1 (audio): 52 packets read (7290 bytes);
Total: 169 packets (6250015 bytes) demuxed
Input file #1 (color=black:s=1366x768:r=25):
Input stream #1:0 (video): 4 packets read (6294528 bytes);