[Ffmpeg-devel] Modding ffmpeg to add fade-in/out and sound looping

Michel Bardiaux mbardiaux
Wed Oct 25 17:02:56 CEST 2006


Joel Reymont wrote:
> Folks,
> 
> I need to mod ffmpeg to be able to overlay several sound samples along 
> the length of a video composed of a number of picture frames.
> 
> I could not figure out if ffmpeg is able to build a 24fps movie out of, 
> say, one jpeg by repeating it 24 times a second. I believe this requires 
> creating several thousand symlinks or copies of my jpeg for a movie of 
> several minutes.

Yes, ffmpeg can do that (you need TWO copies of the JPEG; I was never 
able to do it with only one).

> 
> Did I miss the "repeat-frame" capability in ffmpeg or is this something 
> that I can easily accomplish in code?
> 
> My sound samples have start time, duration, fade-in time, fade-out time 
> as well as a loop flag. If a sample is looped then it continues along 
> the video. This could be a repeated chorus of a song, for example.
> 
> I figure that I can do the fades fairly easily by following the existing 
> volume code. To loop back to the beginning of my audio sample I could 
> use the code that currently seeks to start time. I also think that I 
> will need to change the algorithm used by ffmpeg to grab the next packet 
> to write out.
> 
> ffmpeg will write the packet with the lowest pts, I believe, but this 
> won't work if I need to stop an audio sample after a specified length of 
> time. It also won't work since I need to seek back to the beginning of 
> the audio sample when looping.
> 
> I haven't dug into repeating the jpeg frame 24 times a second yet.
> 
> Do you have any tips for me?

Use ffmpeg to create the video part from JPEGs.

ffmpeg does not do sound effects, other apps exist for that. Use them to 
produce a .wav in pcm at the correct length.

Use ffmpeg to mux the 2 together(and maybe encode the sound).

> 
> Am I going about this properly or is there an easier way?
> 
>     Thanks, Joel
> 
> -- 
> http://wagerlabs.com/
> 

Greetings,
-- 
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/




More information about the ffmpeg-devel mailing list