私は過去2週間FFMpegを実験していて、少し問題があります...最初はGalaxy S3で作業していましたが、これは非常にうまく機能し、これまでで最高の写真を提供してくれましたが、最近に切り替えましたたくさんの問題を私に与えたGalaxyNEXUS...
私がしていること:ビデオからフレームを抽出するだけです
私のやり方:
while(av_read_frame(gFormatCtx, &packet)>=0)
{
// Is this a packet from the video stream?
if(packet.stream_index==videoStream)
{
// Decode video frame
avcodec_decode_video2(gVideoCodecCtx, pFrame, &frameFinished, &packet);
// Did we get a video frame?
if(frameFinished)
{//and so on... But our problem is already here...
さて、今pFrame
は私のフレームのYUV表現を保持しています...それで、avcodec_decode_video2(...)
関数から何を得ているかを確認するために、ファイルに書き込んでいるだけpFrame
で、Web上の任意のYUVリーダーでそれを見ることができます。
char yuvFileName[100];
sprintf(yuvFileName,"/storage/sdcard0/yuv%d.yuv",index);
FILE* fp = fopen(yuvFileName, "wb");
int y;
// Write pixel data
for(y=0; y<gVideoCodecCtx->height; y++)
{
fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, gVideoCodecCtx->width, fp);
}
for(y=0; y<gVideoCodecCtx->height/2; y++)
{
fwrite(pFrame->data[1]+y*pFrame->linesize[1], 1, gVideoCodecCtx->width/2, fp);
}
for(y=0; y<gVideoCodecCtx->height/2; y++)
{
fwrite(pFrame->data[2]+y*pFrame->linesize[2], 1, gVideoCodecCtx->width/2, fp);
}
fclose(fp);
/storage/sdcard0/blabla.YUV
これで、GalaxyNexusルートメモリのファイルストア@に結果が表示されます。
しかし、ファイルを(たとえば、YUVタイプを正しく表示するためのXnView)で開くと、画像に濃い緑色しか表示されません。
気になるのは、Galaxy S3ではすべてが正常に機能したが、GNexusでは何かが失敗したことです...
だからここに私の質問があります:なぜそれはギャラクシーネクサスで動作しないのですか?
Gnexusとarmeabiv7の間の互換性の問題?
知らない !
よろしく、Cehm