Skip to content

Use Encoder as backend of AudioEncoder and VideoEncoder#1478

Merged
NicolasHug merged 4 commits into
meta-pytorch:mainfrom
NicolasHug:encoderbackend
Jun 3, 2026
Merged

Use Encoder as backend of AudioEncoder and VideoEncoder#1478
NicolasHug merged 4 commits into
meta-pytorch:mainfrom
NicolasHug:encoderbackend

Conversation

@NicolasHug

@NicolasHug NicolasHug commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

This PR replaces the AudioEncoder and VideoEncoder implemetations (both Python and C++) with that of the Encoder.
The existing tests of AudioEncoder and VideoEncoder are kept, so if they pass, it means the replacement is safe. We'll remove those tests in a follow-up PR.

Benchmarks show that there's no performance regression. These were obviously ran on main, not on this PR branch.

~/dev/torchcodec-cuda (main*) » python benchmarks/encoders/bench_multi_stream_vs_single_stream.py                                       nicolashug@nicolashug-fedora-PW0H326Y

==================================================
Duration: 3s
==================================================

--- Video encoding (cpu) ---
VideoEncoder:    med = 334.38ms +- 11.86
StreamingEncoder:med = 338.33ms +- 7.96

--- Video encoding (cuda) ---
VideoEncoder:    med = 265.74ms +- 1.37
StreamingEncoder:med = 265.88ms +- 1.36

--- Audio encoding (cpu) ---
AudioEncoder:    med = 0.87ms +- 0.27
StreamingEncoder:med = 0.74ms +- 0.04

==================================================
Duration: 10s
==================================================

--- Video encoding (cpu) ---
VideoEncoder:    med = 1042.70ms +- 20.33
StreamingEncoder:med = 1096.06ms +- 51.35

--- Video encoding (cuda) ---
VideoEncoder:    med = 265.92ms +- 2.52
StreamingEncoder:med = 265.72ms +- 1.21

--- Audio encoding (cpu) ---
AudioEncoder:    med = 1.98ms +- 0.31
StreamingEncoder:med = 2.17ms +- 0.16

@pytorch-bot

pytorch-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1478

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit ae049e1 with merge base 513d73b (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 2, 2026
@NicolasHug NicolasHug merged commit 7f1016b into meta-pytorch:main Jun 3, 2026
82 checks passed
@NicolasHug NicolasHug deleted the encoderbackend branch June 3, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant