Please, document, how you create and fill pFormatContextCopie.
You must call av_new_stream as many times as many streams you want to copy
and fill this structure will appropriate information about the streams. This
will assign pFormatContextCopie->nb_streams and fill the array
pFormatContextCopie->streams with correct values.
Then, for each read packet you must change packet.stream_index.
Initially it points to the appropriate value in the pFormatContex->streams
array, but it must point to the appropriate value in
pFormatContextCopie->streams.
Probably, the easiest way would be avoid using libav* and change bytes in
the file.
Nicolas Krieger wrote:
>
> During a video capture, there is sometimes a crash and the file obtained
> is
> readable, but there is no informations about the length of the video. So,
> I
> want to "repair" the file. What I want to do is to calculate the number of
> frames (I manage to do this) and to put this value in the file. I must
> also
> keep the original file as it is.
> Once I have all the informations (AVFormatContext, AVCodecContext, ...), I
> read the original file :
>
> while(av_read_frame(pFormatContext, &packet) >= 0) {
>
> av_write_frame(pFormatContextCopie, &packet);
>
> }
>
> but it is not correct (as there is a segmentation fault : 0x0805090a in
> compute_pkt_fields2 ()).
>
> What I want to do is just to put the right value
> in pFormatContext->streams[videoStream]->duration
>
>
--
View this message in context:
http://www.nabble.com/how-to-copy-a-video-file-tp19146378p19251850.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user