comparison third_party/ffmpeg/README.md @ 217:7ef4c9d2a72d hg-web

[DO NOT PUSH] Random values.
author MrJuneJune <me@mrjunejune.com>
date Sun, 25 Jan 2026 10:44:04 -0800
parents
children
comparison
equal deleted inserted replaced
192:b818a4561a3c 217:7ef4c9d2a72d
1 # ffmpeg
2
3 FFmpeg wrapper for Bazel projects.
4
5 ## Prerequisites
6
7 FFmpeg must be installed on the system:
8
9 ```bash
10 # Ubuntu/Debian
11 sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev
12
13 # macOS
14 brew install ffmpeg
15
16 # Arch Linux
17 sudo pacman -S ffmpeg
18 ```
19
20 ## Libraries
21
22 ### ffmpeg_cli
23
24 Shells out to the `ffmpeg` and `ffprobe` command-line tools. This is the recommended approach for most projects as it's simpler and doesn't require linking against FFmpeg libraries.
25
26 ```starlark
27 deps = ["//third_party/ffmpeg:ffmpeg_cli"]
28 ```
29
30 ```c
31 #include "third_party/ffmpeg/ffmpeg_cli.h"
32
33 // Convert image to WebP
34 ImageConvertOpts opts = ffmpeg_image_opts_default();
35 opts.quality = 85;
36 ffmpeg_image_to_webp("input.jpg", "output.webp", &opts);
37
38 // Convert video to HLS
39 HlsConvertOpts hls_opts = ffmpeg_hls_opts_default();
40 ffmpeg_video_to_hls("input.mp4", "./output", "video", &hls_opts);
41 ```
42
43 ### ffmpeg (library)
44
45 Links against FFmpeg libraries directly. Use this when you need low-level access to FFmpeg's encoding/decoding APIs.
46
47 ```starlark
48 deps = ["//third_party/ffmpeg:ffmpeg"]
49 ```
50
51 ## API
52
53 ### Image Conversion
54
55 ```c
56 FfmpegResult ffmpeg_image_to_webp(const char* input, const char* output, ImageConvertOpts* opts);
57 ```
58
59 ### Video to HLS
60
61 ```c
62 FfmpegResult ffmpeg_video_to_hls(const char* input, const char* output_dir, const char* name, HlsConvertOpts* opts);
63 ```
64
65 ### Video Thumbnail
66
67 ```c
68 FfmpegResult ffmpeg_video_thumbnail(const char* input, const char* output, int timestamp_seconds);
69 ```
70
71 ### Duration
72
73 ```c
74 FfmpegResult ffmpeg_get_duration(const char* input, double* duration_out);
75 ```