-
-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
bugSomething isn't workingSomething isn't working
Description
There is a regression since ffmpeg 6 that breaks the segmenting.
Test script:
# Generate test file of 20 sec, with keyframes every 2sec
ffmpeg -loglevel warning -fflags +genpts \
-f lavfi -i testsrc=duration=20:size=1280x720:rate=30 \
-f lavfi -i sine=frequency=1000:duration=20 \
-c:v libx264 -g 60 \
-c:a aac -b:a 192k \
-f mp4 -y -movflags +faststart /tmp/test.mp4;
# Seek to 10 sec and create three 2s segments (at 12,14,16)
ffmpeg -loglevel warning -ss 10 -i /tmp/test.mp4 -to 16 -copyts -c copy \
-f segment \
-segment_time_delta 0.2 \
-segment_format mpegts \
-segment_times 12,14,16 \
-segment_start_number 5 \
-segment_list_type csv \
-segment_list pipe:1 /tmp/test_%03d.ts;We can set up a simple dockerfile:
ARG VERSION=3.22
FROM alpine:${VERSION}
RUN apk add --no-cache ffmpeg
ENTRYPOINT [ "ffmpeg" ]And then run scripts above with different versions.
docker build --build-arg VERSION=3.14 -t alpine-ffmpeg:3.14 .
docker run --rm alpine-ffmpeg:3.14 -versionVersions prior 6
ffmpeg version 4.2.4 (from alpine:3.11)
ffmpeg version 4.3.1 (from alpine:3.12)
ffmpeg version 4.3.3 (from alpine:3.13)
ffmpeg version 4.4.1 (from alpine:3.14)
ffmpeg version 5.0.3 (from alpine:3.16)
ffmpeg version 5.1.4 (from alpine:3.17)
test_005.ts,0.000000,12.000000
test_006.ts,12.000000,14.000000
test_007.ts,14.000000,16.000000
test_008.ts,16.000000,16.166667
Versions after 6
ffmpeg version 6.0.1 (from alpine:3.18)
ffmpeg version 6.1.1 (from alpine:3.19)
ffmpeg version 6.1.2 (from alpine:3.21)
test_005.ts,0.000000,16.166667
It seems that it requires now relative offet to the seeked time in segment_times instead of the absolute time.
Modified segmenter script:
ffmpeg -loglevel warning -ss 10 -i /tmp/test.mp4 -to 16 -copyts -c copy \
-f segment \
-segment_time_delta 0.2 \
-segment_format mpegts \
-segment_times 2,4,6 \
-segment_start_number 5 \
-segment_list_type csv \
-segment_list pipe:1 /tmp/test_%03d.ts;New output:
test_005.ts,0.000000,12.000000
test_006.ts,12.000000,14.000000
test_007.ts,14.000000,16.000000
test_008.ts,16.000000,16.166667
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working