Dne Wed, 24 Nov 2010 17:13:06 +0100 Igor R <[email protected]>
napsal(a):
I'm trying to write simple application which will save a video in
desired
format (avi, mkv, ...). I started with api_encode example and it works
fine
until I use the raw format.
Now I would like to use avi for example, but I'm getting segmentation
fault
error - os->streams[stream_index]->priv_data are not initialized, I
think.
AVFormatContext *os;
os = avformat_alloc_context();
AVStream *st;
st = av_new_stream(os, videoStream);
// what initializations should be here?
Have you called avcodec_init(), av_register_all(),
av_alloc_format_context()?
Yes,
this is only the simplified part of my code. I have something like
avcodec_init();
avcodec_register_all(); //registruje kodeky
av_register_all(); //registruje formaty
encoder = avcodec_find_encoder(CODEC_ID_H263);
//encoder settings
AVFormatContext *os;
os = avformat_alloc_context();
AVStream *st;
st = av_new_stream(os, videoStream);
if (os->oformat = av_guess_format("avi", NULL, NULL)<0);
exit(1);
// from ffmpeg
AVFormatParameters params, *ap = ¶ms;
memset(ap, 0, sizeof(*ap));
av_set_parameters(os, ap);
url_fopen(&os->pb, filename, URL_WRONLY)
// what now?
for (;;){
// outpkt preparation
av_interleaved_write_frame(os, &outpkt);
}
It works with os->oformat = av_guess_format("h263", NULL, NULL); which
calls raw formating. However any other format causes segfault after
av_interleaved_write_frame call. Concretely in avi_write_packet function,
because AVFormatContext is not set properly, I think.
regards
Jan
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user