[Ffmpeg-devel] Creating a mpeg2 file from ffplay...
Manuel Giron
memegiron
Mon Sep 4 22:45:28 CEST 2006
Hi,
i want to save all the video that i receive from /dev/video0 with
ffplay.c so I'm been reading the ffmpeg.c / output_example.c and
apiexample.c to see how to save a mpeg2 file.
it doesn't work and i don't know what I'm doing wrong. is this
correct? or i need to put something else.
i create a new file from the "r" key. and this is what im doing with
my make_output().
AVFormatContext *oc;
oc = av_alloc_format_context();
/* checking if the url_file exist */
pstrcpy(oc->title, sizeof(oc->title), "something");
/* the rest here */
if(ulr_fopen(&oc->pb, oc->filename, URL_WRONLY) < 0 ) {
/* print error */
}
/* this is one error i have but i dont know how to send the right string */
oc->oformat = guess_format("mpeg", NULL,NULL);
/* i want mpeg2 so */
oc->oformat->video_codec = CODEC_ID_MPEG2VIDEO;
oc->oformat->audio_codec = CODEC_ID_MP2;
/* here i put bit_rate, rc_max_rate, etc */
/* i need help here */
if (av_set_parameters(oc, ap) < 0 ) {
/* print error */
}
dump_format(oc, 0, oc->filename, 1);
if (av_write_header(oc) < 0) {
/*print error */
}
video_st_out = new_video_stream(oc);
audio_st_out = new_audio_stream(oc);
...
to write im using: av_write_frame(oc, pkt)
my best log output is this one:
url_fopen OK.
AV_set_parameters OK.
before dump_format
Output #0, mpeg to 'file1.mpeg' :
AV_write_header OK.
error, non monotone timestamps 204204 >= 27027
error, non monotone timestamps 204204 >= 30030
error, non monotone timestamps 204204 >= 33033
...
i only want to record a simple mpeg2 file, please help me ;-)
Manny Giron.-
More information about the ffmpeg-devel
mailing list