[FFmpeg-user] Insert black frames -- How?

Mark Filipak (ffmpeg) markfilipak at bog.us
Tue Feb 9 10:31:27 EET 2021


On 02/09/2021 03:05 AM, Michael Koch wrote:
> Mark,
> 
>> I want to insert black frames into a stream on a regular basis.
>> #1, Is that an input device? I think so. Or,
>> #2, is it better/easier to repeat an input frame and blacken the repeated frame? Maybe.
>>
>> I seek guidance. I've read everything I could find. Methinks #1 would be best. But if #2, would a 
>> 'pad' filter that covers the entire frame be best/easiest?
> 
> I think the tricky part is how to insert an additional frame in the video. May be you can split the 
> video in two parts and then concat first part, additional frame, second part...

So far, the best I've been able to figure out is that the members of a split need to retain their 
periodic nature through their respective filtergraph branches, then to explicitly force their PTSs 
via 'setpts' as a function of frame number, 'n', just prior to 'interleave'. In other words, 
'select' at the exit from a filtergraph branch, not at the entrance to a branch.

It also appears that not all filters handle 'n' predictably -- I'm not sure about this -- as 
'interleave' seems to interleave only via PTSs, not frame number.

It would be very helpful if 'interleave' could be replaced by a programmable multiplexer that was 
"input 'n'-aware" and could multiplex and re-PTS its output based on a "input 'x', frame 'n'" 
script. Such a multiplexer could assemble an output stream from a loose, enqueued set of inputs. If 
that multiplexer existed, then the filtergraph branches wouldn't need to be periodic, but could 
output loose frames without PTSs. Ah, well.

>... You would also have to 
> find a suitable solution for the audio track.
> Replacing one frame of the video by another image is easy, see chapter 2.40 in my book:
> http://www.astro-electronic.de/FFmpeg_Book.pdf
> 
> Michael
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


-- 
I don't have a dog.
And furthermore, my dog doesn't bite.
And furthermore, you provoked him.


More information about the ffmpeg-user mailing list