.avi to .mp4


안녕하세요.

브리아나입니다.

HTML 상에서 video를 띄우는 작업을 하고 있는데,

제가 가지고 있는 동영상은 .avi였고 HTML에서 지원하는 코덱과 달랐어요!

잘 작동하지 않아서 이 문제만 1시간을 찾아버렸네요 :)

그럼 해결책 바로 갑니다~!

 

 

1. FFmpeg 다운받기

https://www.ffmpeg.org/

 

FFmpeg

Converting video and audio has never been so easy. $ ffmpeg -i input.mp4 output.avi     News May 31st, 2023, Vulkan decoding A few days ago, Vulkan-powered decoding hardware acceleration code was merged into the codebase. This is the first vendor-generic

www.ffmpeg.org

빨간색으로 표시된 파일 링크를 클릭하시면 아래 페이지로 접속하게 됩니다.

 

2. 설치파일 다운

https://www.gyan.dev/ffmpeg/builds/

 

Builds - CODEX FFMPEG @ gyan.dev

FFmpeg is a widely-used cross-platform multimedia framework which can process almost all common and many uncommon media formats. It has over 1000 internal components to capture, decode, encode, modify, combine, stream media, and it can make use of dozens o

www.gyan.dev

빨간색 표시된 곳을 클릭하면

다운로드에 들어오게 되는데

해당 파일은 압축파일이에요!

만약에 다운로드 폴더 안에 하얀 파일 형태로 되어 있으시면

아래 반디집을 다운받으셔야합니다.

하얀 파일로 되어있으시면

 

3. 반디집 다운로드

https://kr.bandisoft.com/bandizip/

 

반디집 공식 홈페이지 · ALZ, EGG, 7Z, RAR 지원 무료 압축 프로그램

반디집 (Windows) 반디집은 다양한 기능을 제공하고 빠르게 작동하는 압축 프로그램입니다. 무료로도 사용할 수 있으며, 유료 에디션은 다양한 고급 기능을 제공합니다. 주요 기능 지원 OS: Windows 7/

kr.bandisoft.com

 

4. 압축해제

바탕화면에 압축 해제하고 bin 폴더로 들어가서

경로 복사를 해놓고 

환경변수 편집 -> Path -> 해당 경로 추가

과정을 거치고

CMD 창에

$ ffmpeg --version

해서 버전이 나오면 설치 완료!

 

 

5. Python 코드 작성하기

 

import ffmpeg

(
    ffmpeg.input("video_load_path_here.avi")
    .output("video_save_path_here.mp4")
    .run()
)

평소 보지 못한 코드포맷이긴 하지만,

이렇게 작성해야 돌아가더라구요!

 

저는 변환 성공!

Problem.

CPU 11세대 Test 하는데 video full stream 받아오는데서 지연이 걸렸다. Core 4개밖에 되지 않아서 내부 프로세스 다 처리하느라 송출이 느린 것 같았고, 그래서 비디오 인코딩, 디코딩 C로 가속화 할 수 있는 MediaSDK 설치했다. 근데 MediaSDK 설치하는 과정에서 cmake로 build 해야하는데 이때 visual studio c++ 빌드도구까지 없게 되는데,,,

 

Solve.

 

1) Visual Studio 설치

https://visualstudio.microsoft.com/ko/downloads/

 

Visual Studio Tools 다운로드 - Windows, Mac, Linux용 무료 설치

Visual Studio IDE 또는 VS Code를 무료로 다운로드하세요. Windows 또는 Mac에서 Visual Studio Professional 또는 Enterprise Edition을 사용해 보세요.

visualstudio.microsoft.com

위 링크로 접속해서 community 버전을 설치하면 된다.

(꼭 C++ build 도구 선택해서 설치해야한다!!)

예전에 visual studio 2019 c++ build 도구 뭐 이렇게 설치했던 것 같은데 실패!

 

2) CMake 설치

Download | CMake

 

Download | CMake

Current development distribution Each night binaries are created as part of the testing process. Other than passing all of the tests in CMake, this version of CMake should not be expected to work in a production environment. It is being produced so that us

cmake.org

 

운영체제별로 많다. 나는 window msi 버전(실행파일버전)으로 다운받은 후 더블클릭해서 설치했다.

여기서 중요한건 거의 다 next 누르면 되지만 꼭 add to path ~~variable for all users ~~~ 이거 선택해줘야한다. 

안그러면 수동 변수 넣고 재부팅해야하는 귀찮은 과정 수행해야한다 ㅜㅜ

 

3) mediaSDK

https://github.com/Intel-Media-SDK/MediaSDK

 

GitHub - Intel-Media-SDK/MediaSDK: The Intel® Media SDK

The Intel® Media SDK. Contribute to Intel-Media-SDK/MediaSDK development by creating an account on GitHub.

github.com

11세대 Tiger Lake 지원한다고 되어있다. 지원모델까지 자세히 적혀있다.

근데,,자세히보면

라고 적혀있다.. 11세대는 이제 intel 에서 관리안하나부당. 나도 안하고싶다. 11세대 ^.*

 

더 많이 내려가면 사용 방법이 있다. 

이게 되려면 위에있는 1) visual studio , 2) cmake 설치가 되어있어야한다.

아 생각해보니 git 도 설치해야한다.

anaconda가 설치되어있으면 git 설치는 필요없는데 아무것도 없는 새PC라면 git 설치해줘야한다 헿

 

4) git설치

Git - Downloads (git-scm.com)

 

Git - Downloads

Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp

git-scm.com

여기서 운영체제에 맞게 설치하자

 

그럼 다시 돌아와서 명령어를 수행해보자.

git clone https://github.com/Intel-Media-SDK/MediaSDK msdk
cd msdk
mkdir build && cd build
cmake ..

이 4줄만 순서대로 수행하면 된다. 

설명서에 따르면 make -> make install 더 하라고 되어있는데 

왜인지 안된다. 그리고 설치 안해도 작동 잘 된다 :)

 

여기까지하고 내가 실행하려고하는 프로그램을 재기동하니 영상지연문제가 깔끔히 해결되었다.

결론은 11세대를 쓰지말고 최신 12세대를 쓰자.

+ Recent posts