Somebody know how can i add black frames with some text to obtain a output
video.
Thank you
Juan
Sent from my T-Mobile 4G LTE Device
-------- Original message --------
From: Dirr Bernhard <[email protected]>
Date: 2/10/2016 4:29 PM (GMT-05:00)
To: "This list is about using libavcodec, libavformat, libavutil, libavdevice
and libavfilter." <[email protected]>
Subject: Re: [Libav-user] Keeping all frames in mp4 with h264 codec
Hello Arthur,
fine to hear about your success.
I am not "The Master of libav", I just used it, and got some help from
community. You surely searched the documentation on ffmpeg.org. How often you
have to call avcodec_encode_video2 after providing last frame depends on codec.
When it uses heavy compression by coding only the differences between
successive frames, you have to call the function more often, and its ok, when
you get got_packet as false for the first few frames. It is the codecs
responsibility, when it decides to output some data. At end of coding process
you have to ensure to get all retained output from codec.
Your question 1) You have to query codec at end of frames, until it has no more
data to output.
Your question 2) libav does not know, how many packets the codec has pending.
So you have to "loop", until you get no more data.
Your questions 3 & 4) You should always call avcodec_encode_video2 with NULL
after encoding real frames, independend of used codec, until you get no more
data.
Here I would like to thank the ffmpeg/libav community for there engagement.
They provided the solution to the requirements in my project:
- lossless codec: FFV1
- direct output to FTP without the option to reposiotion to some tables at the
beginning of container: NUT Container
regards and good luck to your project
Bernhard
Von: Libav-user [[email protected]] im Auftrag von Arthur Muller
[[email protected]]
Betreff: Re: [Libav-user] Keeping all frames in mp4 with h264 codec
Hi Bernhard,
>after real frames are handled did you call avcodec_encode_video2 with NULL as
>frame as many times as got_packet returns true?
>
>Depending on codec you have to "flush" encoder several times, until all frames
>have gone to output.
Success!! Thanks!
But I do need one clarification: it just so happens that I have 36 frames, half
return got_packet=0 and half return got_packet=1. So I called
avcodec_encode_video2 18 times with a NULL frame. So here are my questions:
1) You mention I call this function with a NULL frame as many times as
got_packet returns true (=1). Shouldn’t it be the other way around? That is, I
should only flush as many times as got_packet returns false (=0)?
2) Is there a way to know exactly how many times I should call this function
with a NULL frame? I can certainly count the number of got_packets={0 or 1};
but I’m wondering whether the ffmpeg api wouldn’t have that information itself
in a way that would be more self-contained.
3) Is it safe to call this function with a NULL packet several times – even
more than necessary to flush everything?
4) Finally, is it safe to call this function several times for other codecs –
even if nothing needs to be flushed? In other words, would ffmpeg treat this
call as a no-op if it’s not necessary?
Thanks again!
-Arthur
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user