Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
video concat
Browse files Browse the repository at this point in the history
  • Loading branch information
wslyvh committed Mar 19, 2023
1 parent c34cc67 commit 78c92cd
Show file tree
Hide file tree
Showing 7 changed files with 1,589 additions and 21 deletions.
Binary file added input/intro.mp4
Binary file not shown.
Binary file added input/video.mp4
Binary file not shown.
Binary file added output/mp4/out.mp4
Binary file not shown.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test:coverage": "NODE_ENV=test jest --coverage --detectOpenHandles --no-cache",
"lint": "eslint --fix",
"prettier": "prettier './src' --write",
"run:concat": "nodemon ./src/concat.ts",
"run:mp3": "nodemon ./src/mp3.ts",
"run:mp3-opening": "nodemon ./src/mp3-opening.ts"
},
Expand Down Expand Up @@ -55,6 +56,7 @@
"devDependencies": {
"@tsconfig/recommended": "^1.0.2",
"@types/dotenv": "^8.2.0",
"@types/ffmpeg-concat": "^1.1.2",
"@types/jest": "^29.2.5",
"@types/markdown-it": "^12.2.3",
"@types/node": "^18.11.18",
Expand All @@ -63,6 +65,7 @@
"eslint": "8.23.1",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"ffmpeg-concat": "^1.3.0",
"husky": "^8.0.3",
"jest": "^29.3.1",
"lint-staged": "^13.1.0",
Expand Down
27 changes: 27 additions & 0 deletions src/concat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import concat from 'ffmpeg-concat'
import { join } from 'path'
import { CONFIG } from 'utils/config'

async function run() {
const out = join(CONFIG.OUTPUT_FOLDER, 'mp4', 'out.mp4')
const intro = join(CONFIG.INPUT_FOLDER, 'intro.mp4')
const video = join(CONFIG.INPUT_FOLDER, 'video.mp4')

await concat({
output: out,
videos: [intro, video],
transition: {
name: 'directionalwipe', // Options: fade, directionalwipe, circleopen, squareswire
duration: 750,
},
})
}

run()
.then(() => {
process.exit(0)
})
.catch((err) => {
console.log(err)
process.exit(1)
})
1 change: 1 addition & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dotenv.config()
export const CONFIG = {
NODE_ENV: process.env.NODE_ENV || 'development',

INPUT_FOLDER: process.env.INPUT_FOLDER || join(process.cwd(), 'input'),
OUTPUT_FOLDER: process.env.OUTPUT_FOLDER || join(process.cwd(), 'output'),
BITRATE: process.env.BITRATE || 128,

Expand Down
Loading

0 comments on commit 78c92cd

Please sign in to comment.