Skip to content

Commit 3073f7f

Browse files
committed
[dev] call ffmpeg command line and api to test cpu transcode performance
1 parent 7f2bf32 commit 3073f7f

29 files changed

+1885
-0
lines changed

container/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:latest
2+
3+
RUN apt-get update && apt-get install -y libatomic1
4+
5+
CMD ["bash"]

container/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker build -t ffmpeg_transcode .

scripts/0.init.x64-linux.ubuntu.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
# apt
4+
sudo apt install linux-libc-dev ntpdate
5+
6+
# update datetime (for ./vcpkg install pkgconf to fix ERROR: Clock skew detected. File vcpkg/buildtrees/pkgconf/x64-linux-dbg/meson-private/coredata.dat has a time stamp 0.4692s in the future)
7+
8+
# install latest python through minconda (for ./vcpkg install pkgconf)
9+
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py39_24.4.0-0-Linux-x86_64.sh
10+
bash Miniconda3-py39_24.4.0-0-Linux-x86_64.sh
11+
# press ENTER to view licenses
12+
# press yes when "'Please answer 'yes' or 'no':" displayed on screen
13+
# press ENTER to install into default location when "Miniconda3 will now be installed into this location:" displayed on screen
14+
# press yes when "You can undo this by running `conda init --reverse $SHELL`? [yes|no]" displayed on screen
15+
source ~/.bashrc
16+
17+
# install cmake >= 3.29.6 and add it's bin path to system environment PATH
18+
cd ~
19+
mkdir .local
20+
cd .local
21+
wget https://github.com/Kitware/CMake/releases/download/v3.29.6/cmake-3.29.6-linux-x86_64.sh
22+
bash cmake-3.29.6-linux-x86_64.sh
23+
# press y to accept licenses
24+
# press no to install cmake resources to ~/.local
25+
echo $PATH = $PATH:~/.local/bin >> ~/.bashrc
26+
cd -
27+
28+
29+
# install llvm and set soft link for clang and clang++
30+
wget https://apt.llvm.org/llvm.sh
31+
sudo bash llvm 18
32+
cd /usr/bin
33+
sudo ln -s clang++-18 clang++
34+
sudo ln -s clang-18 clang
35+
cd -
36+
37+
38+
# cd to project parent dir
39+
cd ..
40+
41+
42+
# install vcpkg
43+
# commit f7423ee180c4b7f40d43402c2feb3859161ef625 (HEAD -> master, tag: 2024.06.15)
44+
# Author: MonicaLiu <[email protected]>
45+
# Date: Fri Jun 14 11:51:31 2024 -0700
46+
#
47+
# [caf] Update to 0.19.6 (#39288)
48+
#
49+
# ports/caf/fix_cxx17.patch | 31 ++++++++++++-------------------
50+
# ports/caf/portfile.cmake | 4 ++--
51+
# ports/caf/vcpkg.json | 2 +-
52+
# versions/baseline.json | 2 +-
53+
# versions/c-/caf.json | 5 +++++
54+
# 5 files changed, 21 insertions(+), 23 deletions(-)
55+
git clone https://github.com/microsoft/vcpkg.git
56+
cd vcpkg
57+
git reset --hard f7423ee180c4b7f40d43402c2feb3859161ef625
58+
59+
# bootstrap vcpkg
60+
./bootstrap-vcpkg.sh
61+
62+
# vcpkg build and install libraries
63+
./vcpkg install pkgconf
64+
./vcpkg install spdlog
65+
./vcpkg install fmt
66+
./vcpkg install cli11
67+
./vcpkg install thrift
68+
./vcpkg install thrift
69+
./vcpkg install grpc[codegen]
70+
./vcpkg install qtbase
71+
72+
73+
@REM return project dir
74+
cd ../..

scripts/0.init.x64-windows-static.bat

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@echo off
2+
3+
4+
@REM install cmake >= 3.29.6 and add it's bin path to system environment PATH
5+
6+
7+
@REM install visual studio >= 2022 with visual c++ desktop development tools
8+
9+
10+
@REM cd to project parent dir
11+
cd ..
12+
13+
@REM install vcpkg
14+
@REM commit f7423ee180c4b7f40d43402c2feb3859161ef625 (HEAD -> master, tag: 2024.06.15)
15+
@REM Author: MonicaLiu <[email protected]>
16+
@REM Date: Fri Jun 14 11:51:31 2024 -0700
17+
@REM
18+
@REM [caf] Update to 0.19.6 (#39288)
19+
@REM
20+
@REM ports/caf/fix_cxx17.patch | 31 ++++++++++++-------------------
21+
@REM ports/caf/portfile.cmake | 4 ++--
22+
@REM ports/caf/vcpkg.json | 2 +-
23+
@REM versions/baseline.json | 2 +-
24+
@REM versions/c-/caf.json | 5 +++++
25+
@REM 5 files changed, 21 insertions(+), 23 deletions(-)
26+
git clone https://github.com/microsoft/vcpkg.git
27+
cd vcpkg
28+
git reset --hard f7423ee180c4b7f40d43402c2feb3859161ef625
29+
30+
@REM bootstrap vcpkg
31+
bootstrap-vcpkg.bat
32+
33+
@REM vcpkg build and install libraries
34+
vcpkg install pkgconf
35+
vcpkg install spdlog
36+
vcpkg install fmt
37+
vcpkg install cli11
38+
vcpkg install thrift
39+
vcpkg install thrift
40+
vcpkg install grpc[codegen]
41+
vcpkg install qtbase
42+
43+
@REM return project dir
44+
cd ..\..
45+

scripts/1.cfg.cmake.x64-linux.txt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# os
2+
set(ENV{OS} "linux")
3+
4+
# cpu arch
5+
set(ENV{ARCH} "x64")
6+
7+
# extra
8+
set(ENV{EXTRA} "")
9+
10+
# cpu arch + os + extra = triplet
11+
set(ENV{TRIPLET} "$ENV{ARCH}-$ENV{OS}$ENV{EXTRA}")
12+
13+
14+
# current work dir
15+
cmake_path(GET CMAKE_SOURCE_DIR PARENT_PATH ROOT_DIR)
16+
get_filename_component(PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY)
17+
get_filename_component(GRANDFATHER_DIR "${PARENT_DIR}" DIRECTORY)
18+
19+
20+
# vcpkg dir
21+
set(VCPKG_DIR "${GRANDFATHER_DIR}/vcpkg/installed/$ENV{TRIPLET}")
22+
set(VCPKG_SHARE_PATH "${VCPKG_DIR}/share")
23+
set(VCPKG_TOOLS_PATH "${VCPKG_DIR}/tools")
24+
set(ENV{VCPKG_LIB_PATH} "${VCPKG_DIR}/lib")
25+
set(ENV{VCPKG_INCLUDE_PATH} "${VCPKG_DIR}/include")
26+
set(ENV{VCPKG_BIN_PATH} "${VCPKG_DIR}/bin")
27+
28+
29+
# fmt cmake config dir
30+
set(ENV{FMT_CMAKE_PATH} "${VCPKG_SHARE_PATH}/fmt")
31+
32+
# spdlog cmake config dir
33+
set(ENV{SPDLOG_CMAKE_PATH} "${VCPKG_SHARE_PATH}/spdlog")
34+
35+
# protobuf cmake config dir
36+
set(ENV{PROTOBUF_CMAKE_PATH} "${VCPKG_SHARE_PATH}/protobuf")
37+
38+
# upb cmake config dir
39+
set(ENV{UPB_CMAKE_PATH} "${VCPKG_SHARE_PATH}/upb")
40+
41+
# absl cmake config dir
42+
set(ENV{ABSL_CMAKE_PATH} "${VCPKG_SHARE_PATH}/absl")
43+
44+
# c-ares cmake config dir
45+
set(ENV{C_ARES_CMAKE_PATH} "${VCPKG_SHARE_PATH}/c-ares")
46+
47+
# re2 cmake config dir
48+
set(ENV{RE2_CMAKE_PATH} "${VCPKG_SHARE_PATH}/re2")
49+
50+
# grpc cmake config dir
51+
set(ENV{GRPC_CMAKE_PATH} "${VCPKG_SHARE_PATH}/grpc")
52+
53+
# openssl cmake config dir
54+
set(ENV{OPENSSL_CMAKE_PATH} "${VCPKG_SHARE_PATH}/openssl")
55+
56+
# libevent cmake config dir
57+
set(ENV{LIBEVENT_CMAKE_PATH} "${VCPKG_SHARE_PATH}/libevent")
58+
59+
# thrift cmake config dir
60+
set(ENV{THRIFT_CMAKE_PATH} "${VCPKG_SHARE_PATH}/thrift")
61+
62+
# cli11 cmake config dir
63+
set(ENV{CLI11_CMAKE_PATH} "${VCPKG_SHARE_PATH}/cli11")
64+
65+
66+
# pkgconf bin dir
67+
set(ENV{PKGCONF_EXE_PATH} "${VCPKG_TOOLS_PATH}/pkgconf/pkgconf")
68+
set(ENV{PKGCONF_CFG_PATH} "$ENV{VCPKG_LIB_PATH}/pkgconfig")
69+
70+
71+
# output dir
72+
set(ENV{INSTALL_EXE_DIR} "${ROOT_DIR}/rundir/$ENV{TRIPLET}")
73+
set(ENV{OUTPUT_EXE_DIR} "${ROOT_DIR}/output/$ENV{TRIPLET}")
74+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# os
2+
set(ENV{OS} "windows")
3+
4+
# cpu arch
5+
set(ENV{ARCH} "x64")
6+
7+
# extra
8+
set(ENV{EXTRA} "-static")
9+
10+
# cpu arch + os + extra = triplet
11+
set(ENV{TRIPLET} "$ENV{ARCH}-$ENV{OS}$ENV{EXTRA}")
12+
13+
14+
# current work dir
15+
cmake_path(GET CMAKE_SOURCE_DIR PARENT_PATH ROOT_DIR)
16+
get_filename_component(PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY)
17+
get_filename_component(GRANDFATHER_DIR "${PARENT_DIR}" DIRECTORY)
18+
19+
20+
# vcpkg dir
21+
set(VCPKG_DIR "${GRANDFATHER_DIR}/vcpkg/installed/$ENV{TRIPLET}")
22+
set(VCPKG_SHARE_PATH "${VCPKG_DIR}/share")
23+
set(VCPKG_TOOLS_PATH "${VCPKG_DIR}/tools")
24+
set(ENV{VCPKG_LIB_PATH} "${VCPKG_DIR}/lib")
25+
set(ENV{VCPKG_INCLUDE_PATH} "${VCPKG_DIR}/include")
26+
set(ENV{VCPKG_BIN_PATH} "${VCPKG_DIR}/bin")
27+
28+
29+
# fmt cmake config dir
30+
set(ENV{FMT_CMAKE_PATH} "${VCPKG_SHARE_PATH}/fmt")
31+
32+
# spdlog cmake config dir
33+
set(ENV{SPDLOG_CMAKE_PATH} "${VCPKG_SHARE_PATH}/spdlog")
34+
35+
# protobuf cmake config dir
36+
set(ENV{PROTOBUF_CMAKE_PATH} "${VCPKG_SHARE_PATH}/protobuf")
37+
38+
# upb cmake config dir
39+
set(ENV{UPB_CMAKE_PATH} "${VCPKG_SHARE_PATH}/upb")
40+
41+
# absl cmake config dir
42+
set(ENV{ABSL_CMAKE_PATH} "${VCPKG_SHARE_PATH}/absl")
43+
44+
# c-ares cmake config dir
45+
set(ENV{C_ARES_CMAKE_PATH} "${VCPKG_SHARE_PATH}/c-ares")
46+
47+
# re2 cmake config dir
48+
set(ENV{RE2_CMAKE_PATH} "${VCPKG_SHARE_PATH}/re2")
49+
50+
# grpc cmake config dir
51+
set(ENV{GRPC_CMAKE_PATH} "${VCPKG_SHARE_PATH}/grpc")
52+
53+
# openssl cmake config dir
54+
set(ENV{OPENSSL_CMAKE_PATH} "${VCPKG_SHARE_PATH}/openssl")
55+
56+
# libevent cmake config dir
57+
set(ENV{LIBEVENT_CMAKE_PATH} "${VCPKG_SHARE_PATH}/libevent")
58+
59+
# thrift cmake config dir
60+
set(ENV{THRIFT_CMAKE_PATH} "${VCPKG_SHARE_PATH}/thrift")
61+
62+
# cli11 cmake config dir
63+
set(ENV{CLI11_CMAKE_PATH} "${VCPKG_SHARE_PATH}/cli11")
64+
65+
# ffmpeg cmake config dir
66+
set(ENV{FFMPEG_CMAKE_PATH} "${VCPKG_SHARE_PATH}/ffmpeg")
67+
68+
69+
# pkgconf bin dir
70+
set(ENV{PKGCONF_EXE_PATH} "${VCPKG_TOOLS_PATH}/pkgconf/pkgconf.exe")
71+
set(ENV{PKGCONF_CFG_PATH} "$ENV{VCPKG_LIB_PATH}/pkgconfig")
72+
73+
74+
# output dir
75+
set(ENV{INSTALL_EXE_DIR} "${ROOT_DIR}/rundir/$ENV{TRIPLET}")
76+
set(ENV{OUTPUT_EXE_DIR} "${ROOT_DIR}/output/$ENV{TRIPLET}")
77+

scripts/2.gen.cmake.x64-linux.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# -G <generator-name> = Specify a build system generator.
4+
# -S <path-to-source> = Explicitly specify a source directory.
5+
# -C <initial-cache> = Pre-load a script to populate the cache.
6+
# -B <path-to-build> = Explicitly specify a build directory.
7+
cmake \
8+
-G "Unix Makefiles" \
9+
-S src \
10+
-C scripts/1.cfg.cmake.x64-linux.txt \
11+
-B build/x64-linux \
12+
-Wno-dev \
13+
-DOPENSSL_ROOT_DIR="/mnt/d/__develop__/vcpkg/installed/x64-linux" \
14+
-DOPENSSL_LIBRARIES="/mnt/d/__develop__/vcpkg/installed/x64-linux/lib"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@echo off
2+
3+
@REM -G <generator-name> = Specify a build system generator.
4+
@REM -S <path-to-source> = Explicitly specify a source directory.
5+
@REM -C <initial-cache> = Pre-load a script to populate the cache.
6+
@REM -B <path-to-build> = Explicitly specify a build directory.
7+
cmake ^
8+
-S src ^
9+
-C scripts/1.cfg.cmake.x64-windows-static.txt ^
10+
-B build/x64-windows-static ^
11+
-A x64 ^
12+
-Wno-dev ^
13+
-DOPENSSL_ROOT_DIR="d:/__develop__/vcpkg/installed/x64-windows-static" ^
14+
-DOPENSSL_LIBRARIES="d:/__develop__/vcpkg/installed/x64-windows-static/lib"

scripts/3.build.cmake.x64-linux.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
cd build/x64-linux
4+
make -j8
5+
cd -
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
3+
cmake ^
4+
--build build/x64-windows-static ^
5+
--target ALL_BUILD ^
6+
--config Release

0 commit comments

Comments
 (0)