Add ffmpeg example (#61)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
|
||||
CUR_DIR :=$(shell pwd)
|
||||
|
||||
CFLAGS := -I ../
|
||||
LDFLAGS := -L ../build/lib
|
||||
LDFLAGS += -L ../build/_deps/onnxruntime-src/lib
|
||||
LDFLAGS += -lsherpa-onnx-c-api -lsherpa-onnx-core -lonnxruntime -lkaldi-native-fbank-core
|
||||
LDFLAGS += -Wl,-rpath,../build/lib
|
||||
LDFLAGS += -Wl,-rpath,../build/_deps/onnxruntime-src/lib
|
||||
LDFLAGS += -Wl,-rpath,${CUR_DIR}/../build/lib
|
||||
LDFLAGS += -Wl,-rpath,${CUR_DIR}/../build/_deps/onnxruntime-src/lib
|
||||
|
||||
decode-file-c-api: decode-file-c-api.c
|
||||
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// c-api-examples/decode-file-c-api.cc
|
||||
// c-api-examples/decode-file-c-api.c
|
||||
//
|
||||
// Copyright (c) 2023 Xiaomi Corporation
|
||||
|
||||
// This file shows how to use sherpa-onnx C API
|
||||
// to decode a file.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
34
c-api-examples/run.sh
Executable file
34
c-api-examples/run.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then
|
||||
echo "Please download the pre-trained model for testing."
|
||||
echo "You can refer to"
|
||||
echo ""
|
||||
echo "https://k2-fsa.github.io/sherpa/onnx/pretrained_models/zipformer-transducer-models.html#sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english"
|
||||
echo "for help"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f ../build/lib/libsherpa-onnx-core.a && ! -f ../build/lib/libsherpa-onnx-core.dylib && ! -f ../build/lib/libsherpa-onnx-core.so ]]; then
|
||||
echo "Please build sherpa-onnx first. You can use"
|
||||
echo ""
|
||||
echo " cd /path/to/sherpa-onnx"
|
||||
echo " mkdir build"
|
||||
echo " cd build"
|
||||
echo " cmake .."
|
||||
echo " make -j4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f ./decode-file-c-api ]; then
|
||||
make
|
||||
fi
|
||||
|
||||
./decode-file-c-api \
|
||||
./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt \
|
||||
./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.onnx \
|
||||
./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx \
|
||||
./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.onnx \
|
||||
./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/test_wavs/0.wav
|
||||
Reference in New Issue
Block a user