2013-11-28 3 views
1

저는 현재 안드로이드에서 ffmpeg를 사용하려고합니다. https://github.com/halfninja/android-ffmpeg-x264을 사용하여 ffmpeg를 만들었습니다 (libx264를 사용하지 않고 GCC 4.6을 사용하여 ndk-r9b로 빌드했습니다). MP4 파일을 자르려고합니다. 그러나 입력 파일이 열리지 않는 :안드로이드에서 ffmpeg 디코딩

 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): ffmpeg 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): -i 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): /storage/emulated/0/DCIM/20131126_173903.mp4 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): -ss 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): 2 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): -t 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): 4 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): -vcodec 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): copy 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): -acodec 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): copy 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): /storage/emulated/0/DCIM/trimmed-000-20131126_173903.mp4 
11-28 10:59:18.494: INFO/com.rfc.video.VideoKit(4125): Running main 
11-28 10:59:18.494: INFO/Videokit(4125): Initializing AV codecs 
11-28 10:59:18.494: INFO/Videokit(4125): ffmpeg version 0.9.2, Copyright (c) 2000-2012 the FFmpeg developers 
11-28 10:59:18.494: INFO/Videokit(4125): built on Nov 27 2013 15:38:26 with gcc 4.6 20120106 (prerelease) 
11-28 10:59:18.494: INFO/Videokit(4125): configuration: --enable-cross-compile --arch=arm5te --enable-armv5te --target-os=linux --disable-stripping --prefix=../output --disable-neon --enable-version3 --ar=arm-linux-androideabi-ar --disable-shared --enable-static --enable-gpl --enable-memalign-hack --cc=arm-linux-androideabi-gcc --ld=arm-linux-androideabi-ld --extra-cflags='-fPIC -DANDROID -D__thumb__ -mthumb -Wno-deprecated' --disable-everything --enable-decoder=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg --enable-demuxer=image2 --enable-muxer=mp4 --enable-decoder=rawvideo --enable-protocol=file --enable-hwaccels --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-filter=buffer --enable-filter=buffersink --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2 
11-28 10:59:18.494: INFO/Videokit(4125): libavutil 51. 32. 0/51. 32. 0 
11-28 10:59:18.494: INFO/Videokit(4125): libavcodec 53. 42. 4/53. 42. 4 
11-28 10:59:18.494: INFO/Videokit(4125): libavformat 53. 24. 2/53. 24. 2 
11-28 10:59:18.494: INFO/Videokit(4125): libavdevice 53. 4. 0/53. 4. 0 
11-28 10:59:18.494: INFO/Videokit(4125): libavfilter 2. 53. 0/2. 53. 0 
11-28 10:59:18.494: INFO/Videokit(4125): libswscale 2. 1. 0/2. 1. 0 
11-28 10:59:18.494: INFO/Videokit(4125): libpostproc 51. 2. 0/51. 2. 0 
11-28 10:59:18.504: ERROR/Videokit(4125): /storage/emulated/0/DCIM/20131126_173903.mp4: Invalid data found when processing input 

내가는 FFmpeg의 코드로 팠하고, 발견 한 오류 다음 로그 캣에 나타난 바와 같이

static int opt_input_file(OptionsContext *o, const char *opt, const char *filename) 
{ 

// ... 

ic->video_codec_id = video_codec_name ? 
    find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0)->id : CODEC_ID_NONE; 
ic->audio_codec_id = audio_codec_name ? 
    find_codec_or_die(audio_codec_name , AVMEDIA_TYPE_AUDIO , 0)->id : CODEC_ID_NONE; 
ic->subtitle_codec_id= subtitle_codec_name ? 
    find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : CODEC_ID_NONE; 
ic->flags |= AVFMT_FLAG_NONBLOCK; 
ic->interrupt_callback = int_cb; 

if (loop_input) { 
    LOGW(
     "-loop_input is deprecated, use -loop 1\n" 
     "Note, both loop options only work with -f image2\n" 
    ); 
    ic->loop_input = loop_input; 
} 

/* open the input file with generic avformat function */ 
err = avformat_open_input(&ic, filename, file_iformat, &format_opts); 
if (err < 0) { 
    print_error(filename, err); 
    exit_program(1); 
} 
assert_avoptions(format_opts); 

// ... 

} 

err 여기 AVERROR_INVALIDDATA 같다. 나는 이유를 이해하지 못한다. mp4 코덱이 가능하다. 그것을 해결하는 방법에 어떤 힌트?

편집 : ffmpeg 코드를 추가했습니다. 나는 이것이 코덱 문제라고 확신한다. ic-> video_codec_id는 CODEC_ID_NONE으로 설정되어 icNULL으로 설정하고 avformat_open_input()에 실패를 반환한다.

답변

1

사실상 코덱 문제였습니다. libx264를 지원하는 ffmpeg를 다시 컴파일하면이 문제가 해결되었습니다.

관련 문제