[FFmpeg-user] insert a logo at certain frames
jacky
renaux.jacky at orange.fr
Thu May 17 08:21:25 CEST 2012
Hi
he is my batch file the input is the file to encode
the <file>.avs is created with avisynth and
is the input ffmpeg file
you'll find attached the animated logo which is not from myself
an avisynth gourou did it for me
sorry it is commeted in french but if you need a translation I will
help
you'll have also attached the file created by the batch file in this
particular
case I was using vob input file. All dll files are from avisynth download
the only one filter which can be missing is the attached one
set source_file= <infile>.avi
set f_avs = temp.avs
echo global dir_source = "%source_file%" > %f_avs%
echo global dir_plug = "c:/streaming/avisynth/" >> %f_avs%
echo global infile = "%source_file%" >> %f_avs%
echo LoadPlugin (dir_plug + "MSharpen.dll") >> %f_avs%
echo video = DirectShowSource(infile).converttoyuy2() >> %f_avs%
echo global logofile = "c:/streaming/programme/images/" +
"utl.jpg" >> %f_avs%
echo Import( dir_plug + "InsertAnimateLogo.avs") >> %f_avs%
echo logo = reduceby2(ReduceBy2(ImageSource(logofile))) >> %f_avs%
echo opacity=0.4 >> %f_avs%"
echo c_alpha=$ffffff >> %f_avs%"
echo
insertAnimateLogo(video,logo,mode=1,tolerance=50,opacity=opacity,pad=20,speed=1,showmask=false,c_alpha=c_alpha)
>> %f_avs%"
then
ffmpeg -i %f_avs% ..................................
regards
jacky
Le 17/05/2012 07:56, Rossana Guerra a écrit :
> thanks, I'll take a look, however I couldn't find where is the part to
> insert logo from framex1 to frame x2.
> I appreciate any suggestion.
>
> Regards
>
> Rossana
>
>
> 2012/5/17 jacky<renaux.jacky at orange.fr>
>
>> Hi
>> I did use Avisynth for such, this has to be pipelined with ffmpeg (the
>> avisynth
>> output to the ffmpeg input )
>> http://avisynth.org/mediawiki/**Main_Page<http://avisynth.org/mediawiki/Main_Page>
>> You also could insert a logo which is moving all around the screen this
>> means which
>> it cannot be replaced automatically by an other one
>> regards
>> jacky
>>
>> Le 17/05/2012 04:44, Rossana Guerra a écrit :
>>
>>> Here is the command I find after googling and reading here
>>> http://ffmpeg.org/libavfilter.**html<http://ffmpeg.org/libavfilter.html> (overlay section)
>>>
>>> ffmpeg -i video1.avi -vf "movie=md.png [logo]; [in][logo]
>>> overlay=W-w-10:10
>>> [out]" output3.avi
>>>
>>> video1.avi - source video
>>> md.png - name of the logo (it could be a bmp/jpg)
>>> output3.avi - the processed avi file
>>>
>>> Hope it helps you.
>>>
>>> the links (labels into []) are described in the documentation which isn't
>>> very clear enough in my opinion.
>>> Any reading suggested?
>>>
>>> Regards
>>>
>>> Rossana
>>>
>>> 2012/5/16 Bhikkhu Mettavihari<tv.lists at gmail.com**>
>>>
>>> Hello Rossana,
>>>> I would like to learn from you.
>>>> what is the command you are using to insert a logo to the entire file.
>>>>
>>>> regards
>>>> Mettavihari
>>>>
>>>> On Thu, May 17, 2012 at 6:10 AM, Rossana Guerra<guerra.rossana at gmail.**
>>>> com<guerra.rossana at gmail.com>
>>>>
>>>>> wrote:
>>>>> Hi everyone, I need to insert a logo from a certain period of times or
>>>>> frames. Is there a way?
>>>>> I could insert a logo but it appears during the whole video.
>>>>>
>>>>> I am using .avi files.
>>>>>
>>>>> Thanks and regards
>>>>>
>>>>> Rossana
>>>>> ______________________________**_________________
>>>>> ffmpeg-user mailing list
>>>>> ffmpeg-user at ffmpeg.org
>>>>> http://ffmpeg.org/mailman/**listinfo/ffmpeg-user<http://ffmpeg.org/mailman/listinfo/ffmpeg-user>
>>>>>
>>>>>
>>>> --
>>>> Streaming video from http://dharmavahini.tv
>>>> ______________________________**_________________
>>>> ffmpeg-user mailing list
>>>> ffmpeg-user at ffmpeg.org
>>>> http://ffmpeg.org/mailman/**listinfo/ffmpeg-user<http://ffmpeg.org/mailman/listinfo/ffmpeg-user>
>>>>
>>>> ______________________________**_________________
>>> ffmpeg-user mailing list
>>> ffmpeg-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/**listinfo/ffmpeg-user<http://ffmpeg.org/mailman/listinfo/ffmpeg-user>
>>>
>>> ______________________________**_________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/**listinfo/ffmpeg-user<http://ffmpeg.org/mailman/listinfo/ffmpeg-user>
>>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
-------------- next part --------------
# ---------------------
# jabali_09-2009 v0.2
# http://www.unite-video.com/ forum AviSynth
# ----------------
function InsertAnimateLogo(clip c , clip logo ,int "mode",float "speed" , int "tolerance" , float "opacity",int "pad", int "c_alpha" , bool "showmask")
{
Assert(mode == 0 || mode == 1 , "mode =0 ou mode=1")
Assert(speed > 0 , "speed =< 0 error ")
mode = Default (mode,0) # mode=0 ou mode=1
speed = Default(speed , 1) # nombre de cycle par film = vitesse du defilement
tolerance = Default(tolerance,30) # paramètre de d'ajustage de la transparence.-A moduler pour affiner la couche transparente.
C_Alpha = Default(C_Alpha,$000000) # definie la couleur qui est transparente pour le logo. Le masque sera automatiquement construit avec cette couleur
opacity = Default(opacity,0.8) # definie la transparence
pad = Default(pad,10) # correction en px pour recentrer le logo (éloigner des bords)
showmask = Default(showmask,false) # N'affiche que le masque
length = FrameCount(c)/speed
anim_mask = create_logoMask(c,logo,round(length),pad,c_alpha,mode).loop() #création _ import du masque + loop(indispensable si speed>1)
alpha = ColorKeyMask (anim_mask,c_alpha,tolerance) #met la couleur C_Alpha comme transparente
mask = ShowAlpha(alpha)
return showmask ? anim_mask : overlay(c,anim_Mask,0,0,mask,opacity) #incrustation de l'animation
}
##### création du masque animé
function Create_logoMask(clip c, clip logo, length, pad , c_alpha , mode)
{
fond = blankclip(c,color=c_alpha).killaudio()
L = fond.width() #largeur du masque
H = fond.height() #hauteur du masque
##### calculs pour assurer une vitesse de croisière constante quelque soit la résolution #####
DAR = Float(L)/float(H)
t1 = round(length*DAR/(2*(DAR+1)))
t2 = round(length/(2*(DAR+1)))
X = logo.width()+pad #largeur logo-gif
Y = logo.height()+pad #hauteur logo-gif
##### coordonées des déplacements
#####------------mode----0-----------1--.....
X_0 = Select(mode, pad , -X )
Y_0 = Select(mode, pad , pad )
X_1 = Select(mode, L-X , L )
Y_1 = Select(mode, pad , pad )
X_2 = Select(mode, L-X , L-X )
Y_2 = Select(mode, pad , 0 )
X_3 = Select(mode, L-X , L-X )
Y_3 = Select(mode, H-Y , H )
X_4 = Select(mode, L-X , L )
Y_4 = Select(mode, H-Y , H-Y )
X_5 = Select(mode, pad , -X )
Y_5 = Select(mode, H-Y , H-Y )
X_6 = Select(mode, pad , pad )
Y_6 = Select(mode, H-Y , H )
X_7 = Select(mode, pad , pad )
Y_7 = Select(mode, pad , -Y )
haut = animate (0,t1,"overlay",fond,logo,X_0,Y_0,fond,logo,X_1,Y_1) .trim(0,t1)
droite = animate (0,t2,"overlay",fond,logo,X_2,Y_2,fond,logo,X_3,Y_3) .trim(0,t2)
bas = animate (0,t1,"overlay",fond,logo,X_4,Y_4,fond,logo,X_5,Y_5) .trim(0,t1)
gauche = animate (0,t2,"overlay",fond,logo,X_6,Y_6,fond,logo,X_7,Y_7) .trim(0,t2)
alignedsplice(haut,droite,bas,gauche).converttorgb32()# A éditer pour changer de parcours
}
-------------- next part --------------
global dir_source = "test.vob"
global dir_plug = "c:/streaming/avisynth/"
global infile = "test.vob"
global logofile = "c:/streaming/programme/images/" + "utl.jpg"
import(dir_plug + "softsharpen.avsi")
Import( dir_plug + "InsertAnimateLogo.avs")
LoadPlugin(dir_plug + "undot.dll")
LoadPlugin(dir_plug + "MSharpen.dll")
LoadPlugin(dir_plug + "ASharp.dll")
LoadPlugin(dir_plug + "DGDecode.dll")
LoadPlugin(dir_plug + "Deen.dll")
LoadPlugin(dir_plug + "GradFun2db.dll")
LoadPlugin(dir_plug + "MVtools2.dll")
LoadPlugin(dir_plug + "mt_masktools.dll")
logo = reduceby2(ReduceBy2(ImageSource(logofile)))
video = DirectShowSource(infile).converttoyuy2()
opacity=0.4
c_alpha=$ffffff
InsertAnimateLogo(video,logo,mode=1,tolerance=50,opacity=opacity,pad=20,speed=1,showmask=false,c_alpha=c_alpha)
More information about the ffmpeg-user
mailing list