[FFmpeg-user] cannot seek into png 'video'
Moritz Barsnick
barsnick at gmx.net
Tue Oct 1 10:35:18 EEST 2019
Moin Thorsten,
On Tue, Oct 01, 2019 at 00:56:33 +0000, Thorsten von Eicken wrote:
> I'm trying to put an overlay over a video and I'm having difficulties
> seeking into the png in order to time-shift the video and overlay
> relative to one another.
I don't really understand what you are trying to do, neither from this
sentence:
> If I'd now like to skip the first 10 seconds of the overlay in order to
> line up the timing better I try to use:
"Line up timing" or "time shift" are nice terms, but all "-ss" does it
to shift the starting point of the input file to a certain point. E.g.
"-ss 10" skips the first 10 seconds.
> In short, using `-ss` on the png results in an
> error like "overlay.png: could not seek to position 10.000". Is there a
> work-around?
When providing a static image as overlay, the image is overlaid over
all the base video's frames. What do you expect to change if you jump
10 seconds into the overlay? It would still be the identical image
(assuming the image is converted to a video stream or interpreted
repeatedly - see below).
> What I'm doing is I'm generating a png 'video' for the overlay, i.e., a
> file with png images one after the other at a frame rate of 1 fps. I can
> do the overlay with something like:
"images one after another" - are you saying that the images are
changing? I.e. different images, changing every second?
> ffmpeg -i 20190928_155656_stab.mp4 -framerate 1 -c:v png -i overlay.png \
> -filter_complex "[0:v]setpts=PTS-STARTPTS[top];
> [1:v]setpts=PTS-STARTPTS[bottom];
> [top][bottom]overlay=x=(W-w)/2:eof_action=pass" \
> -acodec aac -vcodec libx264 final.mp4
With "eof_action=pass", only one frame of the overlay will be used, as
the PNG stream only provides one frame with your current command line.
If you want to make the PNG into a video stream, you can add the input
option "-stream_loop -1". But you can just as well just omit the
"eof_action=" option, which will make the filter use
"eof_action=repeat", which will automatically use the PNG as a sort of
video stream. (Actually, the filter just re-uses the last frame
encountered.)
> But that results in the error. Using `-ss` on the mp4 input works great
> to time-shit in the other direction.
(Nice typo.) Now back to the original issue: What are you trying to
do? If you want to skip over the first 10 seconds of the input video,
then "-ss" needs to be an option for the input video of course, not for
the PNG.
Sorry if I'm adding to the confusion, but I personally am confused. ;-)
Cheers,
Moritz
More information about the ffmpeg-user
mailing list