Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for decoding using FFmpeg in the main example #2432

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ option(WHISPER_BUILD_SERVER "whisper: build server example" ${WHISPER_STANDALO
option(WHISPER_CURL "whisper: use libcurl to download model from an URL" OFF)
option(WHISPER_SDL2 "whisper: support for libSDL2" OFF)

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
option(WHISPER_FFMPEG "whisper: support building and linking with ffmpeg libs (avcodec, swresample, ...)" OFF)
endif()
option(WHISPER_FFMPEG "whisper: support building and linking with ffmpeg libs (avcodec, swresample, ...)" OFF)

option(WHISPER_COREML "whisper: enable Core ML framework" OFF)
option(WHISPER_COREML_ALLOW_FALLBACK "whisper: allow non-CoreML fallback" OFF)
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,12 @@ override CXXFLAGS := $(CXXFLAGS) -DWHISPER_USE_CURL
override LDFLAGS := $(LDFLAGS) -lcurl
endif

ifdef WHISPER_FFMPEG
OBJ_COMMON += examples/ffmpeg-transcode.o
override CXXFLAGS := $(CXXFLAGS) -DWHISPER_FFMPEG
override LDFLAGS := $(LDFLAGS) -lavutil -lavformat -lavcodec -lswscale -lswresample
endif

#
# Print build information
#
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,15 @@ The command downloads the `base.en` model converted to custom `ggml` format and

For detailed usage instructions, run: `./main -h`

Note that the [main](examples/main) example currently runs only with 16-bit WAV files, so make sure to convert your input before running the tool.
Note that the [main](examples/main) example currently runs by default with 16-bit WAV files.

Building with `WHISPER_FFMPEG=1` enables ffmpeg support to handle other formats:

```bash
WHISPER_FFMPEG=1 make main
```

If you do not want to rebuild it, convert your input before running the tool.
For example, you can use `ffmpeg` like this:

```bash
Expand Down
Loading