[FFmpeg-user] Replace dropped frames in H264

Aviv Hurvitz aviv.hurvitz at gmail.com
Tue Dec 18 22:32:32 EET 2018

I am dealing with a system that transfers H264 over the internet in the
following way:
We break the encoded stream into frames, then we send individual frames
over the network, then we piece the stream back together.

The problem is that due to inadequate network speed we sometimes drop
frames out of the stream. When we piece the stream back together, it has
gaps of course, which corrupts that group-of-frames, but what is worse -
seeking by timestamp is incorrect.

What I want to do is fill the dropped frames with some spacer that will
ensure the video has the correct length and seeks by timestamp will work.

I am willing to replace individual frames or even entire groups-of-frames
to make the seeking work.

The video is fixed rate 25 FPS, has no B frames, has I frames every second.
I know exactly which frames were dropped.
My question is: how do I make the spacer frames? Say, if a P frame was
lost, would it make sense to duplicate the P frame that came before it to
make a spacer?

More information about the ffmpeg-user mailing list