[FFmpeg-trac] #9053(avcodec:new): (armv6k) The video is NOT decoded correctly in some resolution
FFmpeg
trac at avcodec.org
Tue Jan 5 12:01:33 EET 2021
#9053: (armv6k) The video is NOT decoded correctly in some resolution
-------------------------------------+-------------------------------------
Reporter: | Type: defect
Core_2_Extreme |
Status: new | Priority: important
Component: avcodec | Version: git-
| master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
I wrote code that decode one frame and save gray image and run armv6k
platform(Nintendo 3DS).
640 * 360 (360p)
decoded correctly
https://i.gyazo.com/4ee6f273fc50826985c3bbd34d6456cf.png
854 * 480 (480p)
NOT decoded correctly
https://i.gyazo.com/8b4dda3e7404725d845ea9a8fa879531.png
1280 * 720 (360p)
decoded correctly
https://i.gyazo.com/4e24acec518a3b61dba629e128ef68b2.png
I tried h.264 and motion jpeg.
My compile command line is
{{{
./configure --enable-cross-compile --cross-
prefix=/opt/devkitpro/devkitARM/bin/arm-none-eabi-
--prefix=/opt/devkitpro/libctru --cpu=armv6k --arch=arm --target-os=linux
--extra-cflags="-mfloat-abi=hard -mtune=mpcore -mtp=cp15" --extra-ldflags
="-mfloat-abi=hard" --disable-filters --disable-devices --disable-bsfs
--disable-parsers --disable-muxers --disable-hwaccels --disable-debug
--disable-programs --disable-avdevice --disable-swscale --disable-postproc
--disable-avfilter --disable-decoders --disable-encoders --disable-
demuxers --disable-asm --disable-protocols --enable-
decoder="aac,ac3,bmp,gif,h263,h264,hevc,jpeg,jpeg2000,mjpeg,mp1,mp2,mp3,mpeg1video,mpeg2video,mpeg4,msmpeg4*,pcm*,vorbis,webp"
--enable-encoder="aac,avi,mp2,mpeg4" --enable-
demuxer="aac,ac3,avi,gif,h263,h264,hevc,matroska,m4v,mjpeg,mjpeg_2000,mpegvideo,mpjpeg,mp3,mov,pcm*,ogg,wav"
--enable-protocol="file"
}}}
My test code is
{{{
void test_thread(void* arg)
{
int ffmpeg_result = 0;
int video_stream_num = -1;
AVFormatContext* format_context = NULL;
AVPacket *packet = NULL;
AVFrame *raw_data = NULL;
AVCodecContext *context = NULL;
AVCodec *codec = NULL;
format_context = avformat_alloc_context();
ffmpeg_result = avformat_open_input(&format_context, "/720p.avi",
NULL, NULL);
Log_log_save("test thread", "avformat_open_input()...",
ffmpeg_result);
ffmpeg_result = avformat_find_stream_info(format_context, NULL);
Log_log_save("test thread", "avformat_find_stream_info()...",
ffmpeg_result);
//find video stream
for(int i = 0; i < (int)format_context->nb_streams; i++)
{
if(format_context->streams[i]->codecpar->codec_type ==
AVMEDIA_TYPE_VIDEO)
video_stream_num = i;
/*else if(format_context->streams[i]->codecpar->codec_type ==
AVMEDIA_TYPE_AUDIO)
vid_audio_stream_num = i;*/
}
if(video_stream_num != -1)
{
codec =
avcodec_find_decoder(format_context->streams[video_stream_num]->codecpar->codec_id);
if(!codec)
Log_log_save("test thread",
"avcodec_find_decoder()...failed", -1);
context = avcodec_alloc_context3(codec);
if(!context)
Log_log_save("test thread",
"avcodec_alloc_context3()...failed", -1);
ffmpeg_result = avcodec_parameters_to_context(context,
format_context->streams[video_stream_num]->codecpar);
Log_log_save("test thread",
"avcodec_parameters_to_context()...", ffmpeg_result);
ffmpeg_result = avcodec_open2(context, codec, NULL);
Log_log_save("test thread", "avcodec_open2()...",
ffmpeg_result);
while(true)
{
packet = av_packet_alloc();
if(!packet)
Log_log_save("test thread",
"av_packet_alloc()...failed ", -1);
ffmpeg_result = av_read_frame(format_context,
packet);
Log_log_save("test thread", "av_read_frame()...",
ffmpeg_result);
if(packet->stream_index == video_stream_num)
{
raw_data = av_frame_alloc();
if(!raw_data)
Log_log_save("test thread",
"av_frame_alloc()...failed ", -1);
ffmpeg_result =
avcodec_send_packet(context, packet);
Log_log_save("test thread",
"avcodec_send_packet()...", ffmpeg_result);
ffmpeg_result =
avcodec_receive_frame(context, raw_data);
Log_log_save("test thread",
"avcodec_receive_frame()...", ffmpeg_result);
//log image info
Log_log_save("test thread", "w " +
std::to_string(raw_data->width) + " h " +
std::to_string(raw_data->height), 1234567890);
//save gray raw image
File_save_to_file("gray.raw",
raw_data->data[0], raw_data->width * raw_data->height, "/", true);
av_packet_free(&packet);
av_frame_free(&raw_data);
break;
}
av_packet_free(&packet);
}
avcodec_free_context(&context);
avformat_close_input(&format_context);
}
else
Log_log_save("test thread", "no video codec", 1234567890);
}
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9053>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list