Skip to content

Commit

Permalink
dev merge (#18)
Browse files Browse the repository at this point in the history
* test: add get videos list test error
* remove rs action
* doc: update
* feat: try add web ui and web server
  • Loading branch information
gsxhnd authored Mar 4, 2024
1 parent bc15b5a commit d94b415
Show file tree
Hide file tree
Showing 27 changed files with 837 additions and 733 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/release_rs.yml

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Garage

Unstable version,change to rust

`garage`是一个命令行工具,提供爬虫和批处理等功能。

[更新日志](./CHANGELOG.md)
Expand Down
100 changes: 49 additions & 51 deletions docs/ffmpeg.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,42 @@
使用 FFMPEG 对多个视频快速转码或其他操作

- [x] convert 批量视频转码
- [x] add_sub 批量视频添加字幕
- [x] add_fonts 批量视频添加字体

```shell
# 视频批量转码
$ garage ffmpeg-batch convert
# 视频批量添加字幕和字体
$ garage ffmpeg-batch add-sub
# 子命令
convert batch video convert other format
add_sub batch video add one suffix subtittle
add_fonts batch video add fonts from dir
```

## 视频转码

```shell
# 硬件加速 https://trac.ffmpeg.org/wiki/HWAccelIntro#VideoToolbox
# h264 转码
ffmpeg.exe -i input.mp4 -c:v h264_nvenc output.mkv
# h265 cpu 10bit 转码
ffmpeg -i INPUT.mp4 -c:v libx265 -crf 20 -pix_fmt yuv420p10le OUTPUT.mkv
# h265 nvida加速 10bit 转码
ffmpeg -i INPUT.mp4 -c:v hevc_nvenc -pix_fmt p010le -rc vbr -cq:v 27 OUTPUT.mkv
# h264/h265 apple silicon 硬件加速转码
# q:v 1-100 1 lowest, 100 highest
ffmpeg -i INPUT.mp4 -c:v h264_videotoolbox -pix_fmt yuv444p -cq:v 27 OUTPUT.mkv
ffmpeg -i INPUT.mp4 -c:v hevc_videotoolbox -pix_fmt yuv444p -cq:v 27 OUTPUT.mkv
```

```shell
$ ffmpeg-batch convert --help

--input_path <> input directory path
--input_format <> input directory path [default: mp4]
--output_path <> output directory path [default: ./dest]
--output_format <> output directory path [default: mkv]
--advance <> advance string
--exec exec command
```

## 字幕添加
Expand All @@ -18,16 +49,23 @@ $ garage ffmpeg-batch add-sub
```shell
## ffmpeg 对应命令
ffmpeg.exe -i INPUT -c copy -i INPUT.ass -sub_charenc UTF-8 -c copy -map 0 -map -0:s -map 1 -metadata:s:s:0 language=chi -metadata:s:s:0 title="jp&sc" OUTPUT
```

```shell
## garage 对应命令
garage ffmpeg-batch add-sub \
--input-path="queue" \
--input-type=".mkv" \
--input-sub-suffix=".ass" \
--output-path="result/" \
--exec=true
$ garage ffmpeg-batch add-sub

--input_path <FILE> input directory path
--input_format <FILE Extension> input directory path [default: mkv]
--sub_suffix <FILE> sub suffix and extension [default: ass]
--sub_number <FILE> sub number [default: 0]
--output_path <FILE> output directory path [default: ./dest]
--output_format <FILE Extension> output directory path [default: mkv]
--advance <> advance string
--exec exec command
```

添加字幕同时添加多个字体
## 添加多个字体

```shell
## ffmpeg 对应命令
Expand All @@ -43,46 +81,6 @@ garage ffmpeg-batch add-sub \
--exec=true
```

## 视频转码

```shell
## ffmpeg 对应命令
ffmpeg.exe -i input.mp4 -c:v h264_nvenc output.mkv

## garage 对应命令
garage.exe ffmpeg-batch convert --input-path="queue" \
--input-type=".mp4" \
--output-path="result/" \
--output-type=".mkv" \
--advance="-c:v h264_nvenc" --exec
```

h256_10bit 转码

```shell
ffmpeg -i INPUT.mp4 -c:v libx265 -crf 20 -pix_fmt yuv420p10le OUTPUT.mkv

## garage 对应命令
garage.exe ffmpeg-batch convert --input-path="queue" \
--input-type=".mp4" \
--output-path="result/" \
--output-type=".mkv" \
--advance="-c:v libx265 -crf 20 -pix_fmt yuv420p10le" --exec
```

h256_10bit 转码 nvdia 硬件加速

```shell
ffmpeg -i INPUT.mp4 -c:v hevc_nvenc -pix_fmt p010le -rc vbr -cq:v 27 OUTPUT.mkv

## garage 对应命令
garage.exe ffmpeg-batch convert --input-path="queue" \
--input-type=".mp4" \
--output-path="result/" \
--output-type=".mkv" \
--advance="-c:v hevc_nvenc -pix_fmt p010le -rc vbr -cq:v 25" --exec
```

## 切割视频 && 导出字幕文件

推荐使用 [Lossless Cut](https://github.com/mifi/lossless-cut)软件
Expand Down
94 changes: 0 additions & 94 deletions docs/ffmpeg_rs.md

This file was deleted.

4 changes: 3 additions & 1 deletion garage-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"build:report": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.6.7",
"ky": "^1.2.0",
"pinia": "^2.1.7",
"vue": "^3.4.15",
"vue-router": "^4.2.5",
Expand All @@ -20,6 +21,7 @@
"@types/node": "^20.11.19",
"@vitejs/plugin-vue": "^5.0.3",
"less": "^4.2.0",
"rollup-plugin-visualizer": "^5.12.0",
"typescript": "^5.2.2",
"vite": "^5.1.0",
"vite-plugin-vuetify": "^2.0.1",
Expand Down
5 changes: 5 additions & 0 deletions garage-ui/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<script setup lang="ts">
import { RouterView } from "vue-router";
import { testStore } from "@/stores/index";
import { userLogin, testApi } from "@/api/user";
testStore();
userLogin();
testApi().catch((err) => {
console.log(err);
});
</script>

<template>
Expand Down
12 changes: 8 additions & 4 deletions garage-ui/src/api/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import http from "@/utils/http";
import { AxiosResponse } from "axios";
import { httpv2 } from "@/utils/http";

export const userLogin = (): Promise<AxiosResponse<any, any>> =>
http.get("/user/logion");
const userLogin = () => httpv2.get("user/logion");

const testApi = () => {
return httpv2.get("api");
};

export { userLogin, testApi };
12 changes: 12 additions & 0 deletions garage-ui/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ const count = ref(0);
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>

<v-select
:items="[
'California',
'Colorado',
'Florida',
'Georgia',
'Texas',
'Wyoming',
]"
variant="outlined"
></v-select>
</div>
</template>

Expand Down
36 changes: 23 additions & 13 deletions garage-ui/src/layout/DashboardLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,34 @@
<v-img src="vite.svg"></v-img>
</a>
</template>

<v-app-bar-title>Application Bar</v-app-bar-title>
</v-app-bar>
<v-navigation-drawer
model-value
class="pt-4"
color="grey-lighten-3"
expand-on-hover
:rail="layoutStore.app_bar.rail"
>
<!-- <v-avatar
v-for="n in 6"
:key="n"
:color="`grey-${n === 1 ? 'darken' : 'lighten'}-1`"
:size="n === 1 ? 36 : 20"
class="d-block text-center mx-auto mb-9"
></v-avatar> -->
<v-list density="compact" nav>
<v-list-item
prepend-icon="mdi-folder"
title="My Files"
value="myfiles"
></v-list-item>
<v-list-item
prepend-icon="mdi-account-multiple"
title="Shared with me"
value="shared"
></v-list-item>
<v-list-item
prepend-icon="mdi-star"
title="Starred"
value="starred"
></v-list-item>
</v-list>
</v-navigation-drawer>

<v-main>
<!-- -->
<router-view> </router-view>
<router-view></router-view>
</v-main>
</v-app>
</template>
Expand All @@ -41,4 +47,8 @@ import { useLayoutStore } from "@/stores/layout";
const layoutStore = useLayoutStore();
</script>

<style scoped lang="less"></style>
<style scoped lang="less">
.v-app-bar {
background-color: #e9ebf2;
}
</style>
7 changes: 7 additions & 0 deletions garage-ui/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ import "vuetify/styles";
import { createVuetify } from "vuetify";
import { aliases, mdi } from "vuetify/iconsets/mdi";
import "@mdi/font/css/materialdesignicons.css";
import theme from "./theme";

const vuetify = createVuetify({
icons: {
defaultSet: "mdi",
aliases,
sets: { mdi },
},
theme: {
defaultTheme: "myCustomLightTheme",
themes: {
myCustomLightTheme: theme,
},
},
});

const pinia = createPinia();
Expand Down
Loading

0 comments on commit d94b415

Please sign in to comment.