сделать простой конвертер видео файлов.
Но пропал интерес.
Выкладываю некоторые наработки. (возможности
Конвертируем: avi, flv, mpg и swf файлы.
По этому принципу сделана программа для записи всех действий с рабочего стола. (создаём скрины и преобразовываем их в видео файл.)
Enumeration
#Window_0
#fon
#clos
#minimize
#Frame3D
#String_1
#String_2
#But_1
#But_2
#start
#Progress
#Progress2
#flv
#avi
#mpg
#swf
#flv_img
#avi_img
#swf_img
#mpg_img
#img
#tamer
#tam
#Font
EndEnumeration
#PBS_MARQUEE = 8
#PBM_SETMARQUEE = #WM_USER + 10
Global Rename.s, Filename.s, ras.s="flv"
UsePNGImageDecoder()
CreateImage(#tam, 150,15,32)
LoadFont(#Font, "Arial",9)
Procedure tamer(t)
StartDrawing(ImageOutput(#tam))
DrawingMode(#PB_2DDrawing_AlphaChannel)
Box(0, 0, 150, 15, RGBA(255, 255, 255, 0))
DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
DrawingFont(FontID(#Font))
DrawText( 0, 0,"Время обработки: " +FormatDate("%ii:%ss", t))
StopDrawing()
SetGadgetState(#tamer,ImageID(#tam))
EndProcedure
Procedure Create(*x)
AddWindowTimer(#Window_0, 2, 1000)
HideGadget(#Progress,0): HideGadget(#Progress2,1)
SendMessage_(GadgetID(#Progress), #PBM_SETMARQUEE, 1, 50) ;on
RunProgram("FFmpeg","-i "+Rename+" -y -sameq "+Filename+"."+ras.s,"", #PB_Program_Wait)
SendMessage_(GadgetID(#Progress), #PBM_SETMARQUEE, 0, 0) ;off
HideGadget(#Progress,1): HideGadget(#Progress2,0)
RemoveWindowTimer(#Window_0, 2)
RunProgram(GetCurrentDirectory(),"","",#PB_Program_Wait)
EndProcedure
CatchImage(#fon, ?Im1,?Im1End-?Im1)
CatchImage(#flv_img, ?Im2,?Im2End-?Im2)
CatchImage(#avi_img, ?Im3,?Im3End-?Im3)
CatchImage(#swf_img, ?Im4,?Im4End-?Im4)
CatchImage(#mpg_img, ?Im5,?Im5End-?Im5)
If OpenWindow(#Window_0,0,0,700,440,"Окно",#PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Window_Invisible)
SetWinBackgroundImage(WindowID(#Window_0),ImageID(#fon))
HyperLinkGadget(#clos,680, 5, 10, 12,"x",RGB(255, 255, 255))
PureCOLOR_SetGadgetColor(#clos,RGB(128, 128, 128),#PureCOLOR_DontSetBackColor)
SetGadgetColor(#clos,#PB_Gadget_FrontColor,RGB(162, 162, 162))
HyperLinkGadget(#minimize,660, 5, 10, 12,"--",RGB(255, 255, 255))
PureCOLOR_SetGadgetColor(#minimize,RGB(128, 128, 128),#PureCOLOR_DontSetBackColor)
SetGadgetColor(#minimize,#PB_Gadget_FrontColor,RGB(162, 162, 162))
Frame3DGadget(#Frame3D,15, 75, 670, 333, "Конвертируем видео файл")
ImageGadget(#img,20,11,130,50,ImageID(#flv_img))
;---------------------------------------------------------------------
HyperLinkGadget(#flv,250, 42, 25, 12,"FLV",RGB(255, 255, 255))
PureCOLOR_SetGadgetColor(#flv,RGB(195, 195, 195),#PureCOLOR_DontSetBackColor)
SetGadgetColor(#flv,#PB_Gadget_FrontColor,RGB(177, 177, 177))
HyperLinkGadget(#avi,300, 42, 25, 12,"AVI",RGB(255, 255, 255))
PureCOLOR_SetGadgetColor(#avi,RGB(195, 195, 195),#PureCOLOR_DontSetBackColor)
SetGadgetColor(#avi,#PB_Gadget_FrontColor,RGB(177, 177, 177))
HyperLinkGadget(#mpg,350, 42, 25, 12,"MPG",RGB(255, 255, 255))
PureCOLOR_SetGadgetColor(#mpg,RGB(195, 195, 195),#PureCOLOR_DontSetBackColor)
SetGadgetColor(#mpg,#PB_Gadget_FrontColor,RGB(177, 177, 177))
HyperLinkGadget(#swf,400, 42, 25, 12,"SWF",RGB(255, 255, 255))
PureCOLOR_SetGadgetColor(#swf,RGB(195, 195, 195),#PureCOLOR_DontSetBackColor)
SetGadgetColor(#swf,#PB_Gadget_FrontColor,RGB(177, 177, 177))
;---------------------------------------------------------------------
StringGadget(#String_1,25,95,350,20,"") : ButtonGadget(#But_1,385,95,25,20,"...")
StringGadget(#String_2,25,125,350,20,"") : ButtonGadget(#But_2,385,125,25,20,"...")
DisableGadget(#String_2,1)
DisableGadget(#But_2,1)
ButtonGadget(#start,590,330,80,40,"Пуск")
ProgressBarGadget(#Progress,25,380,650,17,0,100,#PBS_MARQUEE)
HideGadget(#Progress,1)
ProgressBarGadget(#Progress2,25,380,650,17,0,100)
ImageGadget(#tamer,520,42,150,15,0)
PureCOLOR_SetGadgetColor(#tamer,RGB(249, 249, 249),#PureCOLOR_DontSetBackColor)
tamer(t)
EndIf
HideWindow(#Window_0, 0)
Repeat
Event = WaitWindowEvent()
Window = EventWindow()
Gadget = EventGadget()
Select Event
Case #PB_Event_Timer
If EventTimer()=2
t=t+1
tamer(t)
EndIf
Case #WM_LBUTTONDOWN
If Window=#Window_0
SendMessage_(WindowID(#Window_0),#WM_NCLBUTTONDOWN, #HTCAPTION,0)
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case #clos
Break
Case #minimize
ShowWindow_(WindowID(#Window_0),#SW_MINIMIZE)
Case #flv
SetGadgetState(#img, ImageID(#flv_img))
ras.s="flv"
Case #avi
SetGadgetState(#img, ImageID(#avi_img))
ras.s="avi"
Case #swf
SetGadgetState(#img, ImageID(#swf_img))
ras.s="swf"
Case #mpg
SetGadgetState(#img, ImageID(#mpg_img))
ras.s="mpg"
Case #But_1
putch.s = OpenFileRequester("Открыть файл",""," Все файлы (*.*)|*.*",0)
Rename = ReplaceString(putch," ","_")
RenameFile(putch, Rename)
SetGadgetText(#String_1,Rename)
Filename.s = GetFilePart(Rename)
Case #start
CreateThread (@Create(),0)
EndSelect
EndSelect
If Event = #PB_Event_CloseWindow
Break
EndIf
ForEver
DataSection
;{ ресурсы
Im1:
IncludeBinary "фон.png"
Im1End:
Im2:
IncludeBinary "flv.png"
Im2End:
Im3:
IncludeBinary "avi.png"
Im3End:
Im4:
IncludeBinary "swf.png"
Im4End:
Im5:
IncludeBinary "mpg.png"
Im5End:
;}
EndDataSection