Page MenuHome

[WIP] Use H264 codec for proxies
AbandonedPublic

Authored by Richard Antalik (ISS) on Mar 6 2021, 5:02 AM.

Details

Reviewers
None
Maniphest Tasks
T85469: VSE 2.0: Proxy system
Summary

Same patch as D10394, but using H264 codec with small GOP size (2 frames in this case).

Main reason to use H264 is smaller filesize, current patch produces about 3x smaller files.
Playback is also about 1.5x faster than MJPEG

Complexity of this patch is much higher though, because encoder must work in own threadpool and encode frames with own gop size.
This means that scaled frames from encoder must be allocated per packet, which leads to worse performance overall. Patch is still about 3x faster than original. Interesting thing is that there is no performance improvement when running transcoding in more than 4 threads.

Possible ways to improve performance are to reuse memory for packets and frames, which would require redesign, where threads would wait for data to be written.
Another possibly much cleaner method would be to decode portions of input into multiple streams and remux these into proxy file.
In both cases managing complexity would be fairly important as it can get out of hand quite quickly.

Diff Detail

Repository
rB Blender
Branch
h264-proxies (branched from master)
Build Status
Buildable 13292
Build 13292: arc lint + arc unit

Event Timeline

Richard Antalik (ISS) requested review of this revision.Mar 6 2021, 5:02 AM
Richard Antalik (ISS) created this revision.

Really great improvement. I don't know if it is possible so set this flag in the lib "-tune fastdecode", but using it in a ffmpeg command line makes decoding fly here. Ffmpeg encoding/decoding of h264 can also be hardware accelerated(a lot), but may need additional elements to be enabled in the Blender build of the included ffmpeg lib.

Really great improvement. I don't know if it is possible so set this flag in the lib "-tune fastdecode", but using it in a ffmpeg command line makes decoding fly here. Ffmpeg encoding/decoding of h264 can also be hardware accelerated(a lot), but may need additional elements to be enabled in the Blender build of the included ffmpeg lib.

I was looking into -tune fastdecode as well, haven't tried it yet. will do now.

This was meant to be WIP patch, it was added to design task by accident...

Richard Antalik (ISS) retitled this revision from Use H264 codec for proxies to [WIP] Use H264 codec for proxies.Mar 6 2021, 5:38 AM
  • switch to h264
  • Make h264 working without introducing much more complexity
  • Make H264 implementation lot nicer and simpler and use new API.
  • Style/naming
  • Cleanup: Naming

Abandoning this patch in prospect of D10731.