By following ffmpeg examples i realised they don't provide an example that decodes h.264 and save it to desktop in any way. I can decode h.264 but i cannot save it to desktop. How can i do this?
I can get this point but now how can i save it as a video?
while (1) {
if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
break;
if (packet.stream_index == video_stream_index) {
got_frame = 0;
ret = avcodec_decode_video2(dec_ctx, frame, &got_frame, &packet);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error decoding video\n");
break;
}
if (got_frame) {
frame->pts = av_frame_get_best_effort_timestamp(frame);
.
.
.
.
.
.
.
}
av_frame_unref(frame);
}
}
av_packet_unref(&packet);
}