[問題] ffmpeg 沒辦法開檔
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux(arm)
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
我寫了下面這個簡單的程式想開開看檔案,但不知道為什麼都會報錯
google能用的關鍵字都找了: ffmpeg、avformat、invalid data的組合..
看了幾十頁看不到辦法,所以來請教大大Orz
餵入的資料(Input):
./xxx /path/to/file/yyy.mp3
預期的正確結果(Expected Output):
ok!
錯誤結果(Wrong Output):
error: Invalid data found when processing input
程式碼(Code):(請善用置底文網頁, 記得排版)
extern "C"
{
#include <libavformat/avformat.h>
}
int main(int argc, char ** argv)
{
av_register_all();
int err_code = 0;
AVFormatContext *pFormatCtx = NULL;
const char* filename = argv[1];
if ((err_code = (avformat_open_input(&pFormatCtx, filename, NULL, NULL))))
{
char errbuf[1024] = {'\0'};
av_strerror(err_code, errbuf, sizeof(errbuf));
std::cout << "error: " << errbuf << std::endl;
return -1;
}
std::cout << "ok!" << std::endl;
avformat_close_input(&pFormatCtx);
return 0;
}
補充說明(Supplement):
另外不知道會不會是configure的問題? 所以也附上來..
./configure --arch=$(ARCH) --cross-prefix=$(CROSS_COMPILE) \
--disable-bsfs --disable-decoders \
--disable-demuxers --disable-devices \
--disable-encoders --disable-filters \
--disable-filter=aformat --disable-filter=format \
--disable-filter=resample --disable-filter=anull \
--disable-filter=fps --disable-filter=scale \
--disable-filter=asyncts --disable-filter=null \
--disable-filter=setpts --disable-muxers \
--disable-parsers --disable-protocols \
--enable-cross-compile --enable-encoder=mp2 \
--enable-fft --enable-muxer=matroska \
--enable-protocol=file --enable-shared \
--enable-small --enable-version3 \
--extra-cflags="$(CFLAGS)" --extra-ldflags="$(LDFLAGS)" \
--target-os=$(TARGET_OS)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.135.91.184
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1406901563.A.822.html
→
08/04 17:33, , 1F
08/04 17:33, 1F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章