Assertion error when encoding video using ffmpeg library on visual studio c++ -


i have project, need received data rtsp link, decode,resize video, encode , save .mp4 file.

this code:

avpacket destpacket; av_init_packet(&destpacket); destpacket.data = null; destpacket.size = 0; while(av_read_frame(i_format_context, &packet)>=0) {     if(packet.stream_index==video_stream_index) {         int rest = avcodec_decode_video2(copyinputcodec, pframe, &framefinished, &packet);         if(framefinished) {             av_init_packet(&destpacket);             destpacket.data = null;             destpacket.size = 0;             av_free_packet(&destpacket);             //deocde here             int ret_scale = sws_scale(sws_ctx,pframe->data,pframe->linesize,0,copyinputcodec->height,encodeframe->data,encodeframe->linesize);             encodeframe->pts=i;             int ret_enc = avcodec_encode_video2(copyoutputcodec,&destpacket,encodeframe,&encodefinishsed);//<--- problem here.             getchar();         }     } } 

and output error

[swscaler @ 00607880] warning: data not aligned! can lead speedlo ss assertion avctx->codec->encode2 failed @ /home/kyle/software/ffmpeg/source/ffmp eg-git/libavcodec/utils.c:2134

i try run many sample code encode video, result same.

thanks help.

ps: sorry english skill.

there 2 issues here:


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -