2013-12-10 2 views
0

ffmpeg 명령의 출력을 android에서 읽으려고합니다. 나는이 시도했습니다 :ffmpeg 명령의 출력 읽기

try { 
     Process process = Runtime.getRuntime().exec("data/data/com.extremeye/cache/ffmpeg" + " -i " + videoPath + " -y " + framesPath + "%d.jpg"); 
     BufferedReader bufferedReader = new BufferedReader(
     new InputStreamReader(process.getInputStream())); 
     StringBuilder log = new StringBuilder(); 
     String line; 
     while ((line = bufferedReader.readLine()) != null) { 
       log.append(line + "\n"); 
     } 
     Log.d(TAG, log.toString()); 
    } catch (IOException e) { 
    } 

명령 예를 들어 "LS/데이터/데이터/패키지/캐시가"때 그것은 작동하지만 그것은 내는 FFmpeg 명령에서 내가 원하는 데이터를 검색하지 않습니다. 내가 원하는 데이터는 다음과 같아야합니다

enter image description here

을하지만이 명령을 내 코드를 사용할 때 그것은 어떤 데이터를 검색하지 않습니다.

이제는 새로운 코드를 사용하고 있지만 실제로 작동하는 것처럼 보입니다. 나는 이것을 얻고있다 :

[format @ 0xee7450] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'format' 
[scale @ 0xee85f0] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280 h:720 fmt:yuvj420p sar:1/1 flags:0x4 
Output #0, image2, to '/data/data/com.extremeye/cache/frames/%d.jpg': 
Metadata: 
major_brand  : mp42 
minor_version : 0 
compatible_brands: mp41isom 
creation_time : 2013-11-20 14:45:01 
encoder   : Lavf54.6.100 
Stream #0:0(und): Video: mjpeg, yuvj420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 30 tbc 
Metadata: 
creation_time : 2013-11-20 14:45:01 
handler_name : VideoHandler 
Stream mapping: 
Stream #0:0 -> #0:0 (h264 -> mjpeg) 
Press [q] to stop, [?] for help 
frame= 3 fps=1.1 q=2.0 size=  0kB time=00:00:00.10 bitrate= 0.0kbits/s  
frame= 5 fps=1.5 q=5.0 size=  0kB time=00:00:00.16 bitrate= 0.0kbits/s  
frame= 7 fps=1.8 q=10.2 size=  0kB time=00:00:00.23 bitrate= 0.0kbits/s  
frame= 9 fps=1.9 q=16.0 size=  0kB time=00:00:00.30 bitrate= 0.0kbits/s  
frame= 11 fps=1.9 q=21.9 size=  0kB time=00:00:00.36 bitrate= 0.0kbits/s  
frame= 12 fps=1.3 q=24.8 size=  0kB time=00:00:00.40 bitrate= 0.0kbits/s  
frame= 13 fps=1.0 q=24.8 size=  0kB time=00:00:00.43 bitrate= 0.0kbits/s  
frame= 14 fps=1.0 q=24.8 size=  0kB time=00:00:00.46 bitrate= 0.0kbits/s  
frame= 15 fps=1.1 q=24.8 size=  0kB time=00:00:00.50 bitrate= 0.0kbits/s  
frame= 17 fps=1.1 q=24.8 size=  0kB time=00:00:00.56 bitrate= 0.0kbits/s  
frame= 19 fps=1.2 q=24.8 size=  0kB time=00:00:00.63 bitrate= 0.0kbits/s  
frame= 21 fps=1.3 q=24.8 size=  0kB time=00:00:00.70 bitrate= 0.0kbits/s  
frame= 23 fps=1.4 q=24.8 size=  0kB time=00:00:00.76 bitrate= 0.0kbits/s  
frame= 25 fps=1.4 q=24.8 size= 

갑자기 데이터 검색이 중단되고 나는 이유를 모른다 ... 어떤 생각?

답변

2

ffmpeg 인쇄는 stderr에 대한 메시지이므로 stdout을 캡처하고 있습니다. getErrorStream() 사용

+0

대단히 감사합니다! –

+0

제발, 내 질문을 다시 읽어주십시오. 모든 데이터를 검색하지 않습니다 ... 감사합니다. –