[FFmpeg-user] PTS issues when scaling an mp4 generated from a concat of a DASH segments
christopher justin
christopher.justin at gmail.com
Sat May 28 00:14:39 EEST 2022
I am trying to scale down an mp4 generated from concatenating a segmented
DASH init segment and its associated m4s segment. I want to
preserve timestamps, for the purpose of being able to play this segment
seamlessly from a player requesting an MPD.
Here is a simplified example where the m4s segment is 5 seconds:
ffmpeg -i 'concat:./init-stream0.m4s|./chunk-stream0-00008.m4s' -copyts
-acodec copy -an -filter_complex "[0:v]scale=-2:480[scaled]" -map
'[scaled]' out.mp4
What this produces is a 48-sec video with black frames from 0 to 43
seconds, and then the scaled video I expected as the last 5 seconds.
Timestamps are preserved (validated with ffprobe), but because the duration
embedded in the segment is 48 secs, ffmpeg wants the output segment to be
48 seconds in length.
I have tried numerous approaches, like trimming the black (which seems like
a hack):
ffmpeg -i 'concat:./init-stream0.m4s|./chunk-stream0-00008.m4s' -copyts
-acodec copy -c:a copy -filter_complex
"[0:v]scale=-2:480[scaled];[scaled]trim=start=0:duration=42[outv]" -map
'[outv]' out.mp4
Trimming does not seem to work when using copyts and scaling.
Is scaling and preserving timestamps on a single DASH segment not possible
with ffmpeg?
Thanks for any input.
chris
More information about the ffmpeg-user
mailing list