| import { useState, useMemo } from "react"; | |
| import { FFmpeg } from "@ffmpeg/ffmpeg"; | |
| import { guarantee, method, pipe, tapAsync } from "utils"; // jsr:@chomu/utils | |
| export default function GifToMp4Converter() { | |
| const ffmpeg = useMemo(() => new FFmpeg(), []); | |
| const [gifFile, setGifFile] = useState<File | null>(null); | |
| const [videoUrl, setVideoUrl] = useState(""); | |
| const convertGifToVideo = async () => { |
| # !pip install openpyxl pandas | |
| # Note: This code is written under the assumption that | |
| # the schema of all data in the Excel file and sheet is the same. | |
| # ์๋ฆผ: ์ด ์ฝ๋๋ ์์ ํ์ผ๊ณผ ์ํธ ๋ด ๋ชจ๋ ๋ฐ์ดํฐ์ ์คํค๋ง๊ฐ ๋์ผํ๋ค๋ ๊ฐ์ ํ์ ์์ฑ๋์์ต๋๋ค. | |
| import sqlite3 | |
| from pathlib import Path | |
| import pandas as pd |
sync.js๋ฅผ ์ ์ธํ ์ฝ๋๋ ๋ชจ๋ ์คํํ๋ฉด 5์ด ํ โ5secโ์ ์ถ๋ ฅํ๊ณ , ์ด์ด์ 4์ด ํ โ4secโ์ ์ถ๋ ฅํ๊ณ , โฆ, ์ด์ด์ 1์ด ํ โ1secโ์ ์ถ๋ ฅํ๊ณ ์ข ๋ฃํ๋ ์ฝ๋์ ๋๋ค. ๋ค๋ง sync.js๋ ์คํํด๋ณด์๋ฉด ์๊ฒ ์ง๋ง ์์ํ๋ฉด 1์ดํ โ1secโ ์ถ๋ ฅ, ์ด์ด์ 1์ด ํ โ2secโ ์ถ๋ ฅ, โฆ, ์ด์ด์ 1์ดํ โ5secโ์ ์ถ๋ ฅํ๊ณ ์ข ๋ฃํ๋ ์ฝ๋์ ๋๋ค. ํด๋น ๊ธ ์๋๋ก ์ด์ด์ง๋ ์์ผ๋ก ์ฝ๋๋ฅผ ์ฝ์ผ์๋ฉด ์ดํดํ์๊ธฐ ํธํ์ค ๊ฒ๋๋ค.
sync.js ๋ ๋๊ธฐ/๋น๋๊ธฐ์ ๋ํ ์ดํด๊ฐ ์ ํ ์๋ ๊ฒฝ์ฐ ์ผ๋ฐ์ ์ผ๋ก ์์ฑํ๊ฒ ๋๋ ๋ฐฉ์์ ์ฝ๋์ ๋๋ค.
Promise๊ฐ ์๊ธฐ๊ธฐ ์ , CallBack์ ์ด์ฉํด ๋น๋๊ธฐ์ ์ผ๋ก ์คํ๋๋ ์ฝ๋์
๋๋ค.
CallBack์ ์ด์ฉํ๋ค๋ณด๋ ์ด๋ฅธ๋ฐ CallBack ์ง์ฅ์ ๊ฐํ 5์ค์ผ๋ก ๋ค์ฌ ์ด ๋ชจ์ต์ ๋ณผ ์ ์์ต๋๋ค.