Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevmo314/codec-from-scratch
Build a simple video encoder from scratch
https://github.com/kevmo314/codec-from-scratch
codec go golang tutorial video
Last synced: 17 days ago
JSON representation
Build a simple video encoder from scratch
- Host: GitHub
- URL: https://github.com/kevmo314/codec-from-scratch
- Owner: kevmo314
- License: apache-2.0
- Created: 2022-11-23T19:00:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T05:32:58.000Z (over 1 year ago)
- Last Synced: 2024-08-03T09:03:53.527Z (4 months ago)
- Topics: codec, go, golang, tutorial, video
- Language: Go
- Homepage:
- Size: 28.7 MB
- Stars: 285
- Watchers: 5
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Video Encoding from Scratch
**Big fan of video? Have questions or want to learn more? Join us on [Discord](https://discord.gg/dVshPbrggM)!**
Ever wondered how a video encoder works? This is a simple video encoder
that walks through building a video encoder from scratch to achieve a 90% compression ratio!https://user-images.githubusercontent.com/511342/203627486-611066cd-f8e5-48c1-863b-eab9529ff90d.mp4
Start by opening up `main.go`. You can run the code by running
`cat video.rgb24 | go run main.go` and you should see this as output```sh
$ cat video.rgb24 | go run main.go
2022/11/23 13:54:03 Raw size: 53996544 bytes
2022/11/23 13:54:03 YUV420P size: 26998272 bytes (50.00% original size)
2022/11/23 13:54:03 RLE size: 13592946 bytes (25.17% original size)
2022/11/23 13:54:15 DEFLATE size: 5457415 bytes (10.11% original size)
```The actual encoding is done in about 120 lines of code. This is meant
to be a didactic exercise rather than a comprehensive guide, but maybe
if there's interest we could add more features that appear in modern video
codecs.Sample video from [Ketut Subiyanto](https://www.pexels.com/video/a-little-girl-preparing-a-scramble-egg-meal-4823190/).
## Other languages
* Rust: https://github.com/Carel155/codec-from-scratch-rust