ffmpeg에 h264인코딩 방법

lelele의 이미지


ffmpeg decoding_encoding 예제 실행하는데

h264만 안 되네요..

codec not found. 라고..

avcodec_find_encoder에 왜 h264만 못찾을까요

./configure --list-encoders 해보면

있는 걸로 나오는 거 같은데..

이것 때문에 며칠째 막혀있는 건지ㅠ

Necromancer의 이미지

x264 라이브러리 설치 하셨나요? ffmpeg도 h264코덱 쓸때는 x264 호출 합니다.

Written By the Black Knight of Destruction

lelele의 이미지

./configure --list-encoders 했을때 libx264가 표시 되면 제대로 설치 된 거 아닌가요?

따로 확인 할 방법이 있나요?

last_x264.tar.bz2 받아서 설치한다고 했는데..

Necromancer의 이미지

./configure는 설치된 옵션 보는게 아니라 소스 빌드 인스톨할때 빌드옵션 넣는 스크립트입니다.

소스 인스톨했다면 x264부터 빌드 인스톨하고, x264 지원옵션 추가해서 ffmpeg 재빌드 인스톨해야 할겁니다.

Written By the Black Knight of Destruction

lelele의 이미지

싹밀고 다시해도 안 되네요.. 빼먹은게 뭔지 도저히 알 수가 없네요..

lelele의 이미지

싹밀고 다시해도 안 되네요.. 빼먹은게 뭔지 도저히 알 수가 없네요..

bushi의 이미지

> 따로 확인 할 방법이 있나요?
>

[schoi0@sel-schoi0-d2 support]$ ffmpeg -encoders
.
.
Encoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
.
.
 V..... libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V..... libx264rgb           libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
.
.

http://ffmpeg.org/general.html#OpenH264
http://ffmpeg.org/general.html#x264

어지간하면 소스받아다 직접 컴파일 할 필요가 없는데요.
예를 들면 http://rpmfusion.org/ , http://www.deb-multimedia.org/ .
참고로, ubuntu 는 ffmpeg/x264 에 대해 별 제한을 두지 않고 메인리포지토리에 그냥 두고 있습니다. free speach 가 아니라 free beer 를 따르는 정책인 듯 합니다.

lelele의 이미지

V..... libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
V..... libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)

나오는데 설치 제대로 된걸로 보면 되나요?

답답하네요..

제대로 다 한 거 같은데... 혹시 라이브러리나 해더추가를 더 따로 해야하나요?

추가한다고 해놓긴 했는데 그게 잘못된 건가 싶어서..

bushi의 이미지

아뇨 잘 됐습니다. 더 하실 것 없습니다.

스무고개 놀이 더 하실게 아니라면,
뭘 어떻게해서 어떤 결과를 얻었는지 구체적으로 옮겨 적으세요.

lelele의 이미지

http://yokkohama.tistory.com/entry/ffmpeg-21%EC%9D%84-Visual-Studio-2010-%EC%97%90%EC%84%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%B4-%EB%B9%8C%EB%93%9C%ED%95%98%EA%B8%B0

를 보고 따라했구 x264는 따로 설치했습니다.

x264는 ./configure --enable-shared하고 나온 local 폴더 이름을 x264로 바꾸고

ffmpeg를 ./configure --enable-shared --enable-static --target-os=mingw32 --enable-gpl --enable-libx264
--extra-cflags="-I/x264/include" --extra-ldflags="-L/x264/lib" --enable-gpl 로 했습니다.

https://www.ffmpeg.org/doxygen/3.1/decoding_encoding_8c-example.html

예제 c++로 실행했는데 "Codec not found"라고 나오고 h264가 아닌 코덱에선 동작합니다

윈도우7 에 비주얼스튜디오 2010입니다.

bushi의 이미지

ffmpeg 도 h264 encoding 이 안되나요 ?

windows 용 패키지는 https://ffmpeg.zeranoe.com/builds/ 에서 배포하고 있습니다.

lelele의 이미지

커맨트창에서 "ffmpeg -i frame_%04d.png -c:v h264 test.mp4" 같이 이용하는 것은 됩니다.

근데 그렇게 쓰는게 아니라 avcodec_find_encoder를 쓰려고 하는데

코덱이 안 불러와지는 문제라..

bushi의 이미지

ffmpeg 도 libavcodec 을 쓰는 것이라 차이점이 없습니다.
ffmpeg 빌드는 (아마도 static 으로) 이상없이 된 것 같고, 개발환경이나 실행환경을 들여다보셔야 할 것 같습니다. 예를 들면 dll 의 위치라던가.

lelele의 이미지

ㅠㅠ dll도 실행 파일 폴더에 다 넣어도 그렇네요..

몇 번을 다 밀고 해봤지만..

아무튼 답변 감사합니다 ㅠ

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.