ffmpeg를 사용하여 특정 비디오 파일을 읽으려고하는데 문제가 생겼습니다.ffmpeg로 특정 코덱의 사용을 강제하는 방법은 무엇입니까?
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2)
{
fprintf(stderr, "Filename is needed as an argument\n");
return 1;
}
/* register all formats and codecs */
av_register_all();
AVFormatContext* fmt_ctx = NULL;
/* open input file, and allocate format context */
const char *src_filename = argv[1];
if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) < 0) {
fprintf(stderr, "Could not open source file %s\n", src_filename);
abort();
}
/* retrieve stream information */
AVDictionary * options;
int res = avformat_find_stream_info(fmt_ctx, &options);
if (res < 0) {
fprintf(stderr, "Could not find stream information\n");
abort();
}
...
}
을 내가 지속적으로 다음과 같은 메시지가 점점 오전 :
[아비 @ 005f2fe0] 스트림 0 코덱 매개 변수를 찾을 수 없습니다 (비디오
이
그것을 읽고 시작하는 코드입니다 : 없음 (GRAY/0x59455247), 알 수없는 코덱'분석'및 '조사'옵션의 값을 늘리십시오.
같은 파일에서 ffmpeg 도구를 실행할 때 동일한 메시지가 나타납니다.
그러나 비디오 스트림에는 YUV8 형식의 원시 비디오 데이터가 들어 있습니다. 사실, 내가 -c:v rawvideo
옵션을 통해 ffmpeg로 전달할 때 아무런 문제가 없습니다. 레코딩, 변환 등 - ffmpeg는 마술 도구와 같습니다.
질문 : ffmpeg api를 사용할 때 그 옵션에 해당하는 것은 무엇입니까? 필사적으로 파일 프레임에 액세스해야합니다.
avformat_find_stream_info에서 두 번째 매개 변수를 NULL로 전달할 수 있습니다. – praks411
나는 이전과 마찬가지로 잘 작동하지 않았다. – Srv19