Archiv der Kategorie: Batch Allerlei

Hier werden verschiedene Batch Scripte veröffentlicht. Das ganze dient mehr als Nachschlagewerk. Große Beschreibungen wird es eher nicht geben.

FFmpeg Webstream aufzeichnen mit Timerfunktion

Zum aufzeichnen von Webstreams kann man sich auch eine Timerfunktion basteln. Es funktioniert momentan aber nur am aktuellen Tag.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off
 
set time=%time%
set correntHour=%time:~0,2%
set correntMinutes=%time:~3,2%
set correntSeconds=%time:~6,2%
 
set /a corrTotalSec=%correntHour%*60*60+%correntMinutes%*60+%correntSeconds%
 
echo.
echo Aktuelle Zeit %correntHour%:%correntMinutes%:%correntSeconds%
echo.
echo.------------------------------------------------------------------
echo.Aufnahmezeit in Stunden und Minuten angeben, z.B. 20:5
echo.------------------------------------------------------------------
echo.
 
set /p recTime="Aufnahmezeit angeben: "
set recHour=%recTime:~0,2%
set recMinutes=%recTime:~3,2%
 
set /a recTotalSec=%recHour%*60*60+%recMinutes%*60
set /a sumSec=%recTotalSec%-%corrTotalSec%
 
echo.
echo.
if %sumSec% GTR 0 (
echo.Zur Aufnahme bereit
timeout /T %sumSec% /NOBREAK
)
echo.
echo.
 
set year=%date:~-4%
set month=%date:~-7,2%
set day=%date:~-10,2%
 
C:\cmdtools\ffmpeg -i rtmp://adresse:port/folder/stream -c:v copy -c:a copy output\%year%-%month%-%day%.flv
 
 
pause

FFmpeg: Webstream aufzeichnen

Mit folgendem Script lassen sich Webstreams, welche in dem Protokoll rtmp gesendet werden aufzeichnen. Mit set year/month/day erhält die Datei als Namen das aktuelle Datum.

1
2
3
4
5
6
7
@echo off
 
set year=%date:~-4%
set month=%date:~-7,2%
set day=%date:~-10,2%
 
C:\cmdtools\ffmpeg -y -i rtmp://link_zur_webseite.de/filename.flv -c:v copy -c:a copy output\path\%year%-%month%-%day%.flv

FFmpeg Gamma-Korrektur, bzw. LUT einstellen

1
ffmpeg -loop 1 -f image2 -i Screen_%04d.png -r 25 -vf lutrgb='r=gammaval(0.4545):g=gammaval(0.4545):b=gammaval(0.4545)', crop=1024:768" -pix_fmt yuv420p -c:v libx264 -preset slow -crf 22 -t 60 -y screen.m4v

SendTo mp4 Compression Batch Script

Ein erweitertes Kompression-Script das recht gut in den „SendTo“ Kontext im Explorer passt. Mit dem Script können Ordner mit Framesequenzen und Videofiles gleichermaßen komprimiert werden. Am Anfang findet eine Überprüfung statt, ob alle Tools vorhanden sind.

Die neueste Version ist zu finden unter:

https://github.com/jb-alvarado/media_compressor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
::-------------------------------------------------------------------------------------
:: LICENSE -------------------------------------------------------------------------
::-------------------------------------------------------------------------------------
::	  This Windows Batchscript is for the SendTo Menu. It compress audio, videos and folders with image sequences to mp4.
::    Copyright (C) 2012  jb_alvarado
::
::    This program is free software: you can redistribute it and/or modify
::    it under the terms of the GNU General Public License as published by
::    the Free Software Foundation, either version 3 of the License, or
::    (at your option) any later version.
::
::    This program is distributed in the hope that it will be useful,
::    but WITHOUT ANY WARRANTY; without even the implied warranty of
::    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
::    GNU General Public License for more details.
::
::    You should have received a copy of the GNU General Public License
::    along with this program.  If not, see <http://www.gnu.org/licenses/>.
::-------------------------------------------------------------------------------------
::-------------------------------------------------------------------------------------
 
::-------------------------------------------------------------------------------------
:: History ---------------------------------------------------------------------------
::-------------------------------------------------------------------------------------
::
:: This is version 0.95 from 2012-09-16. Last bigger modification was on 2013-04-09
:: 2012-10-28 - add HQ Avisynth Deinterlacer, Auto Level for the Codec, maxrate, bufsize and small changes
:: 2012-10-29 - build a new installer, most things a now automatic
:: 2012-11-21 - fixing avisynth input, change code layout
:: 2013-04-09 - changing video input, now it use avisynth only for deinterlacing, download sources fixed
:: 2013-05-24 - fixing small things, also a error in the input by frame sequences
::
::-------------------------------------------------------------------------------------
 
@echo off
Setlocal EnableDelayedExpansion 
 
color 87
title media_Compressor
 
:: EncoderSettings -------------------------------
 
set preset=slow
:: ( preset defined how exactly the x264 codec work, slower better and smaller but slower: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo )
 
set quality=22
:: ( quality: 20-26 useful, smaller better quality )
 
set GOPSize=50
:: ( GOPSize: short clips needs smaller value )
 
set fps=
:: ( fps: frames per second, only need this for other frame rate then 25 (for  frame sequences) )
 
set aacEnc=aac -strict experimental
:: ( use "aac -strict experimental" when you have the free distributed Version from ffmpeg, or libfaac/libfdk_aac when you compile by your self )
 
set audioBit=160k
:: ( Audo Bitrate )  
 
set audioCodec=libmp3lame
:: ( libmp3lame, pcm_s24le, pcm_s16le, mp2, ac3, flac, etc. ) 
 
set audioExt=.mp3
:: ( .wav, .mp3, .ac3, mp2, flac, ogg, etc. ) 
 
::------------------------------------------------------------------------------
:: Install Process
::------------------------------------------------------------------------------
if exist "C:\Program Files (x86)" (
	set "InstallPath=C:\Program Files (x86)\BatchMediaCompressor"
	set "AVSPluginFolder=C:\Program Files (x86)\AviSynth 2.5\plugins"
	if exist "!InstallPath!" GOTO checkwget
	MD "!InstallPath!"
) else (
	set "InstallPath=C:\Program Files\BatchMediaCompressor"
	set "AVSPluginFolder=C:\Program Files\AviSynth 2.5\plugins"
	if exist "!InstallPath!" GOTO checkwget
	MD "!InstallPath!"
	)
 
:checkwget
if not exist "%InstallPath%\license" MD "%InstallPath%\license"
if not exist "%InstallPath%\help" MD "%InstallPath%\help"
if not exist "%InstallPath%\readme" MD "%InstallPath%\readme"	
 
if exist "%InstallPath%\wget.exe" GOTO check7z
	echo -------------------------------------------------------------
	echo.
	echo - please download and copy wget.exe to:
	echo - %InstallPath% 
	echo.
	echo - hit key for download
	echo.
	echo -------------------------------------------------------------
	pause
	start "" "http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget.exe"
	pause
if not exist "%InstallPath%\wget.exe" GOTO checkwget
 
:check7z
if exist "%InstallPath%\7za.exe" GOTO checkavisynth
	echo -------------------------------------------------------------
	echo.
	echo - 7z download and install start...
	echo.
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" "http://blog.pixelcrusher.de/downloads/7za920.exe"
	pushd %InstallPath%
	"%InstallPath%\7za920.exe"
	popd
	move "%InstallPath%\7zip-license.txt" "%InstallPath%\license"
	move "%InstallPath%\7-zip.chm" "%InstallPath%\help"
	move "%InstallPath%\7zip-readme.txt" "%InstallPath%\readme"
	del "%InstallPath%\7za920.exe"
 
:checkavisynth
if exist "%windir%\SysWOW64\avisynth.dll" GOTO checkdevIL
if exist "%windir%\System32\avisynth.dll" GOTO checkdevIL
	echo -------------------------------------------------------------
	echo.
	echo - Avisynth will be download and install
	echo.
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" http://sourceforge.net/projects/avisynth2/files/latest/download?source=files
	"%InstallPath%\AviSynth_110525.exe" /S
	del "%InstallPath%\AviSynth_110525.exe"
if exist "%windir%\SysWOW64\DevIL.dll" del "%windir%\SysWOW64\devil.dll"
if exist "%windir%\System32\DevIL.dll" del "%windir%\System32\devil.dll"
 
:checkdevIL
if exist "%windir%\SysWOW64\DevIL.dll" GOTO checkQTGMC
if exist "%windir%\System32\DevIL.dll" GOTO checkQTGMC
	echo -------------------------------------------------------------
	echo.
	echo - Avisynth will be patched and adjusted
	echo.
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" "http://downloads.sourceforge.net/project/openil/DevIL Win32/1.7.8/DevIL-EndUser-x86-1.7.8.zip"
if exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\DevIL-EndUser-x86-1.7.8.zip" -o%windir%\SysWOW64 *.dll -r -y
if not exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\DevIL-EndUser-x86-1.7.8.zip" -o%windir%\System32 *.dll -r -y
 
"%InstallPath%\wget" -P "%InstallPath%" "http://blog.pixelcrusher.de/downloads/avisynth.7z"
if exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\avisynth.7z" -o"%windir%\SysWOW64" *.dll -r -y
if not exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\avisynth.7z" -o"%windir%\System32" *.dll -r -y
 
del "%InstallPath%\DevIL-EndUser-x86-1.7.8.zip"
del "%InstallPath%\avisynth.7z"
 
:checkQTGMC
if exist "%AVSPluginFolder%\QTGMC-3.32.avsi" GOTO checkffms
	echo -------------------------------------------------------------
	echo.
	echo - The deinterlacer QTGMC will be download and install
	echo.
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" "http://www.spirton.com/uploads/QTGMC/QTGMC 32-bit Plugins [Vit-Mod].zip"
	"%InstallPath%\wget" -P "%InstallPath%" "http://www.spirton.com/uploads/QTGMC/QTGMC-3.32.zip"
if exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%windir%\SysWOW64" fftw3.dll -r -y
if exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%windir%\SysWOW64" libfftw3f-3.dll -r -y
if not exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%windir%\System32" fftw3.dll -r -y
if not exist "%windir%\SysWOW64" "%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%windir%\System32" libfftw3f-3.dll -r -y
 
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" mt_masktools-26.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" AddGrainC.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" dfttest.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" EEDI2.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" eedi3.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" FFT3DFilter.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" mvtools2.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" nnedi.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" nnedi2.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" nnedi3.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" RemoveGrainSSE2.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" RepairSSE2.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" SSE2Tools.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" TDeint.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" VerticalCleanerSSE2.dll -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip" -o"%AVSPluginFolder%" yadif.dll -r -y
 
	"%InstallPath%\7za.exe" e "%InstallPath%\QTGMC-3.32.zip" -o"%AVSPluginFolder%" -r -y
 
	del "%InstallPath%\QTGMC 32-bit Plugins [Vit-Mod].zip"
	del "%InstallPath%\QTGMC-3.32.zip"
 
:checkffms
if exist "%AVSPluginFolder%\ffms2.dll" GOTO checkffmpeg
	echo -------------------------------------------------------------
	echo.
	echo - The AVSLoader will be download and install
	echo.
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" --no-check-certificate -P "%InstallPath%" "https://ffmpegsource.googlecode.com/files/ffms-2.17.7z"
	"%InstallPath%\7za.exe" e "%InstallPath%\ffms-2.17.7z" -o"%AVSPluginFolder%" ffms-2.17\FFMS2.avsi -y
	"%InstallPath%\7za.exe" e "%InstallPath%\ffms-2.17.7z" -o"%AVSPluginFolder%" ffms-2.17\ffms2.dll -y
	"%InstallPath%\7za.exe" e "%InstallPath%\ffms-2.17.7z" -o"%AVSPluginFolder%" ffms-2.17\ffmsindex.exe -y
	del "%InstallPath%\ffms-2.17.7z"
 
:checkffmpeg
if exist "%InstallPath%\ffmpeg.exe" GOTO checkmp4box
	echo -------------------------------------------------------------
	echo.
	echo - ffmpeg the compressor will be install
	echo.
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.7z
	"%InstallPath%\7za.exe" e "%InstallPath%\ffmpeg-latest-win32-static.7z" -o"%InstallPath%" *.exe -r -y
	del "%InstallPath%\ffmpeg-latest-win32-static.7z"
 
:checkmp4box
if exist "%InstallPath%\mp4box.exe" GOTO checkMediaInfo 
	echo -------------------------------------------------------------
	echo.
	echo - mp4box the multiplexer will be install
	echo.
	echo -------------------------------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" http://kurtnoise.free.fr/mp4tools/MP4Box-0.4.6-rev2735.zip
	"%InstallPath%\7za.exe" e "%InstallPath%\mp4box-0.4.6-rev2735.zip" -o"%InstallPath%" *.exe -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\mp4box-0.4.6-rev2735.zip" -o"%InstallPath%" *.dll -r -y
	del "%InstallPath%\mp4box"-0.4.6-rev2735.zip"
 
:checkMediaInfo
if exist "%InstallPath%\MediaInfo.exe" GOTO checklink
	echo --------------------------------------
	echo.
	echo - MediaInfo will be install
	echo.
	echo --------------------------------------
	"%InstallPath%\wget" -P "%InstallPath%" "http://downloads.sourceforge.net/project/mediainfo/binary/mediainfo/0.7.61/MediaInfo_CLI_0.7.61_Windows_i386.zip"
	"%InstallPath%\7za.exe" e "%InstallPath%\MediaInfo_CLI_0.7.61_Windows_i386.zip" -o"%InstallPath%" *.exe -r -y
	"%InstallPath%\7za.exe" e "%InstallPath%\MediaInfo_CLI_0.7.61_Windows_i386.zip" -o"%InstallPath%" *.dll -r -y
	del "%InstallPath%\MediaInfo_CLI_0.7.61_Windows_i386.zip"
 
:checklink
if exist "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\SendTo\media_Compressor.lnk" GOTO checkself
	echo -------------------------------------------------------------
	echo.
	echo - bulding Link to the SendTo Menu
	echo.
	echo -------------------------------------------------------------
 
	if exist "%InstallPath%\FFmpeg.ico" GOTO buildlink
	"%InstallPath%\wget" -P "%InstallPath%" "http://blog.pixelcrusher.de/downloads/FFmpeg.ico"
 
:buildlink
	echo.Set Shell = CreateObject^("WScript.Shell"^) >> "%InstallPath%\setlink.vbs"
	echo.Set link = Shell.CreateShortcut^("C:\Users\%username%\AppData\Roaming\Microsoft\Windows\SendTo\media_Compressor.lnk"^) >> "%InstallPath%\setlink.vbs"
	echo.link.Arguments = "" >> "%InstallPath%\setlink.vbs"
	echo.link.Description = "Compress Video or Audio Files, Framesequences or multiplex Video and Audio Files to MP4" >> "%InstallPath%\setlink.vbs"
	echo.link.IconLocation = "%InstallPath%\FFmpeg.ico" >> "%InstallPath%\setlink.vbs"
	echo.link.TargetPath = "%InstallPath%\media_Compressor.bat" >> "%InstallPath%\setlink.vbs"
	echo.link.WindowStyle = 1 >> "%InstallPath%\setlink.vbs"
	echo.link.WorkingDirectory = "%InstallPath%" >> "%InstallPath%\setlink.vbs"
	echo.link.Save>> "%InstallPath%\setlink.vbs" 
 
	cscript /nologo "%InstallPath%\setlink.vbs" 
	del "%InstallPath%\setlink.vbs" 
 
:checkself
if exist "%InstallPath%\media_Compressor.bat" GOTO runscript
	copy /Y "%~f0" "%InstallPath%"
 
if exist "%InstallPath%\Uninstall.bat" GOTO runscript
	echo.@echo off >> "%InstallPath%\Uninstall.bat"
	echo.echo ------------------------------------------------------------- >> "%InstallPath%\Uninstall.bat"
	echo.echo. >> "%InstallPath%\Uninstall.bat"
	echo.echo - Avisynth will not be Uninstall >> "%InstallPath%\Uninstall.bat"
	echo.echo - pleas Uninstall it over your Systemsettings >> "%InstallPath%\Uninstall.bat"
	echo.echo. >> "%InstallPath%\Uninstall.bat"
	echo.echo - hit key to process the Uninstaller >> "%InstallPath%\Uninstall.bat"
	echo.echo ------------------------------------------------------------- >> "%InstallPath%\Uninstall.bat"
	echo pause >> "%InstallPath%\Uninstall.bat"
 
	echo. >> "%InstallPath%\Uninstall.bat"
	echo.del "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\SendTo\media_Compressor.lnk" >> "%InstallPath%\Uninstall.bat"
	echo.pushd ..\ >> "%InstallPath%\Uninstall.bat"
	echo.rmdir /s /q "%InstallPath%" >> "%InstallPath%\Uninstall.bat"
	echo. >> "%InstallPath%\Uninstall.bat"
 
	echo -------------------------------------------------------------
	echo.
	echo - media_Compressor is now installed
	echo - pleas close the Window and use it over
	echo - the Explorer Context Menu: SendTo
	echo.
	echo -------------------------------------------------------------
	pause
	exit
 
:runscript
 
set "input=%~1"
if "%input%"=="" (
	echo.
	echo....................................................................
	echo.
	echo.   Pleas drag and drop Files or Folder on the
	echo.   Script or use it in the SendTo Folder
	echo.
	echo....................................................................
	echo.
	pause
	exit
	)
 
cd /d "%~dp1" 2>nul
cd /d %1 2>nul
 
set x1="%input%"
set x2="%cd%"
 
if "%input%"=="%CD%" GOTO folder
	set /a count=0
	for /f "tokens=* delims= " %%a in ('dir/s/b/a-d %*') do (
		set /a count+=1
		)
 
if not %count%==2 GOTO :audiocomp
 
:: Multiplex and Compression -------------------------------
 
set muxingInput=%~x1-%~x2
 
if "%muxingInput%"==".m2v-.ac3" set or_=true
if "%muxingInput%"==".ac3-.m2v" set or_=true
if "%muxingInput%"==".m2v-.mp2" set or_=true
if "%muxingInput%"==".mp2-.m2v" set or_=true
if "%muxingInput%"==".m2v-.wav" set or_=true
if "%muxingInput%"==".wav-.m2v" set or_=true
if "%muxingInput%"==".avi-.wav" set or_=true
if "%muxingInput%"==".wav-.avi" set or_=true
if "%muxingInput%"==".mov-.wav" set or_=true
if "%muxingInput%"==".wav-.mov" set or_=true
if "%muxingInput%"==".avi-.mp3" set or_=true
if "%muxingInput%"==".mp3-.avi" set or_=true
if "%muxingInput%"==".mov-.mp3" set or_=true
if "%muxingInput%"==".mp3-.mov" set or_=true
if "%muxingInput%"==".mp4-.aac" set or_=true
if "%muxingInput%"==".aac-.mp4" set or_=true
if "%muxingInput%"==".mpeg-.ac3" set or_=true
if "%muxingInput%"==".ac3-.mpeg" set or_=true
if "%muxingInput%"==".mpg-.ac3" set or_=true
if "%muxingInput%"==".ac3-.mpg" set or_=true
if "%muxingInput%"==".mpeg-.mp2" set or_=true
if "%muxingInput%"==".mp2-.mpeg" set or_=true
if "%muxingInput%"==".mpg-.mp2" set or_=true
if "%muxingInput%"==".mp2-.mpg" set or_=true
 
if not %or_%==true GOTO audiocomp
 
if "%~x1"==".avi" GOTO audfirst
if "%~x1"==".m2v" GOTO audfirst
if "%~x1"==".mov" GOTO audfirst
if "%~x1"==".mp4" GOTO audfirst
if "%~x1"==".mpg" GOTO audfirst
if "%~x1"==".mpeg" GOTO audfirst
 
set "vidInput=%~s2"
set "audInput=%~s1"
 
GOTO multiplex
 
:audfirst
set "vidInput=%~s1"
set "audInput=%~s2"
 
:multiplex
pushd "%installpath%"
	FOR /F %%i in ( 'mediainfo --Inform^=^"Video^;%%ScanType/String%%^" %vidInput%' ) do set ScanType=%%i
	FOR /F %%j in ( 'mediainfo --Inform^=^"Video^;%%DisplayAspectRatio%%^" %vidInput%' ) do set aspect=%%j
	FOR /F %%k in ( 'mediainfo --Inform^=^"Video^;%%Width/String%%^" %vidInput%' ) do set Width=%%k
	FOR /F %%l in ( 'mediainfo --Inform^=^"Video^;%%Height/String%%^" %vidInput%' ) do set Height=%%l
	FOR /F %%m in ( 'mediainfo --Inform^=^"Video^;%%Duration/String1%%^" %vidInput%' ) do set Duration=%%m
popd
 
if %Width% LEQ 1024 (
	set level=3.2
	set maxrate=4M 
	set bufsize=4M
	)
 
if %Width% GEQ 1280 (
	set level=4.1
	set maxrate=10M 
	set bufsize=10M
	)
 
if %Width% GEQ 1920 (
	set level=5.1
	set maxrate=20M 
	set bufsize=20M
	)
 
echo.
echo....................................................................
echo.....multiplex and convert Video and Audio-File.....................
echo....................................................................
echo.
echo.Duration:  %Duration%
echo.Scan Type: %ScanType%
echo.Width:     %Width%
echo.Height:    %Height%
echo.Aspect:    %Aspect%
echo.
echo....................................................................
echo....................................................................
echo.
 
if exist "%~n1.avs" del "%~n1.avs" 
if exist "%~n1.h264" del "%~n1.h264" 
if exist "%~n1.aac" del "%~n1.aac" 
if exist "%~s1.ffindex" del "%~s1.ffindex" 
if exist "%~s2.ffindex" del "%~s2.ffindex" 
 
if %ScanType%==Interlaced (
	echo.SetMTMode^(5, 4^) >> "%~n1.avs"
	echo.LoadPlugin("%AVSPluginFolder%\ffms2.dll"^) >> "%~n1.avs"
	echo.Import^("%AVSPluginFolder%\QTGMC-3.32.avsi"^) >> "%~n1.avs"
	echo.A = FFAudioSource^("%audInput%"^) >> "%~n1.avs"
	echo.V = FFVideoSource^("%vidInput%"^) >> "%~n1.avs"
	echo.audiodub^(V,A^) >> "%~n1.avs"
	echo.SetMTMode^(2^) >> "%~n1.avs"
	echo.ConvertToYV12^(interlaced=true^) >> "%~n1.avs"
	echo.QTGMC^( Preset="Slow", EdiThreads=2 ^) >> "%~n1.avs"
	echo.SelectEven^(^) >> "%~n1.avs"
 
	"%InstallPath%\ffmpeg.exe" -y -i "%~n1.avs" -aspect %Aspect% -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level %level% -maxrate %maxrate% -bufsize %bufsize% "%~n1.h264" -c:a %aacEnc% -ab %audioBit% "%~n1.aac"
 
	if exist "%~n1_x264.mp4" del "%~n1_x264.mp4" 
	"%InstallPath%\mp4box" -add "%~n1.h264" -add "%~n1.aac" -hint -brand mp42 "%~n1_x264.mp4"
	if exist "%~n1.avs" del "%~n1.avs" 
	if exist "%~n1.h264" del "%~n1.h264" 
	if exist "%~n1.aac" del "%~n1.aac" 
	if exist "%~s1.ffindex" del "%~s1.ffindex" 
	if exist "%~s2.ffindex" del "%~s2.ffindex" 
 
	GOTO end
	) 
 
"%InstallPath%\ffmpeg.exe" -i %vidInput% -i %audInput% -pix_fmt yuv420p -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level %level% -maxrate %maxrate% -bufsize %bufsize% "%~n1.h264" -c:a %aacEnc% -ab %audioBit% "%~n1.aac"
 
if exist "%~n1_x264.mp4" del "%~n1_x264.mp4"
"%InstallPath%\mp4box" -add "%~n1.h264" -add "%~n1.aac" -hint -brand mp42 "%~n1_x264.mp4"
if exist "%~n1.h264" del "%~n1.h264" 
if exist "%~n1.aac" del "%~n1.aac" 
 
GOTO end
 
:: Audio Compression -------------------------------
 
:audiocomp
 
for %%f in (%*) do (
	if "%%~xf"==".avi" GOTO :videocomp
	if "%%~xf"==".AVI" GOTO :videocomp
	if "%%~xf"==".mp4" GOTO :videocomp
	if "%%~xf"==".MP4" GOTO :videocomp
	if "%%~xf"==".m4v" GOTO :videocomp
	if "%%~xf"==".avs" GOTO :avscomp
	if "%%~xf"==".flv" GOTO :videocomp
	if "%%~xf"==".f4v" GOTO :videocomp
	if "%%~xf"==".mov" GOTO :videocomp
	if "%%~xf"==".MOV" GOTO :videocomp
	if "%%~xf"==".mkv" GOTO :videocomp
	if "%%~xf"==".MKV" GOTO :videocomp
	if "%%~xf"==".wmv" GOTO :videocomp
	if "%%~xf"==".divx" GOTO :videocomp
	if "%%~xf"==".mpg" GOTO :videocomp
	if "%%~xf"==".MPG" GOTO :videocomp
	if "%%~xf"==".mpeg" GOTO :videocomp
	if "%%~xf"==".m2v" GOTO :videocomp
	if "%%~xf"==".ogv" GOTO :videocomp
	if "%%~xf"==".dv" GOTO :videocomp
	if "%%~xf"==".vob" GOTO :videocomp
	if "%%~xf"==".3gp" GOTO :videocomp
	if "%%~xf"==".m2v" GOTO :videocomp
 
	echo.
	echo....................................................................
	echo.
	echo..........converting Audio-File.....................................
	echo.
	echo....................................................................
	echo.
 
	"%InstallPath%\ffmpeg.exe" -i %%f -vn -acodec %audioCodec% -ab %audioBit% "%%~nf_%audioExt%"
	)
 
GOTO end
 
:: Video Compression -------------------------------
 
:avscomp
if not "%~x1"==".avs" GOTO :videocomp
for %%f in (%*) do (
	"%InstallPath%\ffmpeg.exe" -i %%f -pix_fmt yuv420p -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -maxrate 6M -bufsize 6M -c:a %aacEnc% -ab %audioBit% "%%~nf.m4v"
 
	if exist "%%~nf_x264.mp4" del "%%~nf_x264.mp4" 
	"%InstallPath%\mp4box" -add "%%~nf.m4v" -hint -brand mp42 "%%~nf_x264.mp4"
	del "%%~nf.m4v" 
	)
 
GOTO end
 
:videocomp
 
for %%f in (%*) do (
	pushd "%installpath%"
		FOR /F %%i in ( 'mediainfo --Inform^=^"Video^;%%ScanType/String%%^" %%f' ) do set ScanType=%%i
		FOR /F %%j in ( 'mediainfo --Inform^=^"Video^;%%DisplayAspectRatio%%^" %%f' ) do set aspect=%%j
		FOR /F %%k in ( 'mediainfo --Inform^=^"Video^;%%Width/String%%^" %%f' ) do set Width=%%k
		FOR /F %%l in ( 'mediainfo --Inform^=^"Video^;%%Height/String%%^" %%f' ) do set Height=%%l
		FOR /F %%m in ( 'mediainfo --Inform^=^"Video^;%%Duration/String1%%^" %%f' ) do set Duration=%%m
		FOR /F %%n in ( 'mediainfo --Inform^=^"Audio^;%%StreamCount%%^" %%f' ) do set AudioStream=%%n
		popd
 
	set "infile=%%~sf"
 
	if !Width! LEQ 1024 (
		set level=3.2
		set maxrate=4M 
		set bufsize=4M
		)
 
	if !Width! GEQ 1280 (
		set level=4.1
		set maxrate=10M 
		set bufsize=10M
		)
 
	if !Width! GEQ 1920 (
		set level=5.1
		set maxrate=20M 
		set bufsize=20M
		)
 
	echo.
	echo....................................................................
	echo..........converting Video-File.....................................
	echo....................................................................
	echo.
	echo.Duration:  !Duration!
	echo.Scan Type: !ScanType!
	echo.Width:     !Width!
	echo.Height:    !Height!
	echo.Aspect:    !Aspect!
	echo.
	echo....................................................................
	echo....................................................................
	echo.
 
	if exist "%%~nf.h264" del "%%~nf.h264" 
	if exist "%%~nf.aac" del "%%~nf.aac" 
	if exist "%%~nf.avs" del "%%~nf.avs"  
	if exist "%%f.ffindex"  del "%%f.ffindex"  
 
	if "!AudioStream!"=="" (
		if !ScanType!==Interlaced (
			echo.SetMTMode^(5, 4^) >> "%%~nf.avs"
			echo.LoadPlugin("%AVSPluginFolder%\ffms2.dll"^) >> "%%~nf.avs"
			echo.Import^("%AVSPluginFolder%\QTGMC-3.32.avsi"^) >> "%%~nf.avs"
			echo.FFVideoSource^("!infile!"^) >> "%%~nf.avs"
			echo.SetMTMode^(2^) >> "%%~nf.avs"
			echo.ConvertToYV12^(interlaced=true^) >> "%%~nf.avs"
			echo.QTGMC^( Preset="Slow", EdiThreads=2 ^) >> "%%~nf.avs"
			echo.SelectEven^(^) >> "%%~nf.avs"
 
			"%InstallPath%\ffmpeg.exe" -y -i "%%~nf.avs" -aspect !Aspect! -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level !level! -maxrate !maxrate! -bufsize !bufsize! "%%~nf.h264"
 
			if exist "%%~nf_x264.mp4" del "%%~nf_x264.mp4" 
			"%InstallPath%\mp4box" -add "%%~nf.h264" -hint -brand mp42 "%%~nf_x264.mp4"
			del "%%~nf.h264" 
			del "%%~sf.ffindex" 
			del "%%~nf.avs" 	
		) else (
			"%InstallPath%\ffmpeg.exe" -i %%f -pix_fmt yuv420p -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level !level! -maxrate !maxrate! -bufsize !bufsize! "%%~nf.h264"
 
			if exist "%%~nf_x264.mp4" del "%%~nf_x264.mp4" 
			"%InstallPath%\mp4box" -add "%%~nf.h264" -hint -brand mp42 "%%~nf_x264.mp4"
			del "%%~nf.h264" 		
			)
	) else (
		if !ScanType!==Interlaced (
			echo.SetMTMode^(5, 4^) >> "%%~nf.avs"
			echo.LoadPlugin("%AVSPluginFolder%\ffms2.dll"^) >> "%%~nf.avs"
			echo.Import^("%AVSPluginFolder%\QTGMC-3.32.avsi"^) >> "%%~nf.avs"
			echo.A = FFAudioSource^("!infile!"^) >> "%%~nf.avs"
			echo.V = FFVideoSource^("!infile!"^) >> "%%~nf.avs"
			echo.audiodub^(V,A^) >> "%%~nf.avs"
			echo.SetMTMode^(2^) >> "%%~nf.avs"
			echo.ConvertToYV12^(interlaced=true^) >> "%%~nf.avs"
			echo.QTGMC^( Preset="Slow", EdiThreads=2 ^) >> "%%~nf.avs"
			echo.SelectEven^(^) >> "%%~nf.avs"
 
			"%InstallPath%\ffmpeg.exe" -y -i "%%~nf.avs" -aspect !Aspect! -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level !level! -maxrate !maxrate! -bufsize !bufsize! "%%~nf.h264" -c:a %aacEnc% -ab %audioBit% "%%~nf.aac"
 
			if exist "%%~nf_x264.mp4" del "%%~nf_x264.mp4" 
			"%InstallPath%\mp4box" -add "%%~nf.h264" -add "%%~nf.aac" -hint -brand mp42 "%%~nf_x264.mp4"
			del "%%~nf.h264" 
			del "%%~nf.aac" 
			del "%%~sf.ffindex" 
			del "%%~nf.avs" 
		) else (
			"%InstallPath%\ffmpeg.exe" -i %%f -pix_fmt yuv420p -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level !level! -maxrate !maxrate! -bufsize !bufsize! "%%~nf.h264" -c:a %aacEnc% -ab %audioBit% "%%~nf.aac"
 
			if exist "%%~nf_x264.mp4" del "%%~nf_x264.mp4" 
			"%InstallPath%\mp4box" -add "%%~nf.h264" -add "%%~nf.aac" -hint -brand mp42 "%%~nf_x264.mp4"
			del "%%~nf.h264" 
			del "%%~nf.aac" 
			)
		)
	)
 
GOTO end
 
:: ---------------------------------------------------
 
:: Folder Compression -------------------------------
 
:folder
 
set "shortpath=%~s1"
 
if not "%fps%" == "" GOTO comp
set fps=25
 
:comp
 
pushd %input%
	set number=0
 
	for %%i in (*) do (
		set /a number=number+1
		set "file=%%i"
		)
 
	set /a Duration=%number%/25
 
	if %number% LSS 251 set GOPSize=50
 
	set ext=%file:~-4%
	call set name=%%file:%ext%=%%
	set newname=%name:~0,-4%
 
	if %ext% == .exr GOTO compEXR
		set endframe=%name:~-4%
		set frame=%endframe:~0,-3%
 
	if not %frame% == 0 GOTO 4digits
		set frame0=%endframe:~-3%
		set frame1=%endframe:~0,-2%
 
	if not %frame1% == 00 GOTO 3digits
		set frame2=%endframe:~-2%
		set /a startframe=%frame2%-%number%+1
 
	GOTO next
 
	:3digits
	set /a startframe=%frame0%-%number%+1
 
	GOTO next
 
	:4digits
	set /a startframe=%endframe%-%number%+1
 
	:next
	popd
 
set "NewFileName=%newname%%%04d%ext%"
 
pushd "%installpath%" 
	FOR /F %%k in ( 'mediainfo --Inform^=^"Image^;%%Width%%^" "%shortpath%\%file%"' ) do set Width=%%k
	FOR /F %%l in ( 'mediainfo --Inform^=^"Image^;%%Height%%^" "%shortpath%\%file%"' ) do set Height=%%l
	popd
 
if %Width% LEQ 1024 (
	set level=3.2
	set maxrate=4M 
	set bufsize=4M
	)
 
if %Width% GEQ 1280 (
	set level=4.1
	set maxrate=10M 
	set bufsize=10M
	)
 
if %Width% GEQ 1920 (
	set level=5.1
	set maxrate=20M 
	set bufsize=20M
	)
 
echo.
echo....................................................................
echo.....converting Frame Sequence......................................
echo....................................................................
echo.
echo.Duration:  %Duration% Seconds
echo.Width:     %Width%
echo.Height:    %Height%
echo.
echo....................................................................
echo....................................................................
echo.
 
"%InstallPath%\ffmpeg.exe" -start_number %startframe% -i "%input%\%NewFileName%" -r %fps% -pix_fmt yuv420p -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level %level% -maxrate %maxrate% -bufsize %bufsize% "%input%\..\%newname%.h264"
 
if exist "%input%\..\%newname%_x264.mp4" del "%input%\..\%newname%_x264.mp4"
"%InstallPath%\mp4box" -add "%input%\..\%newname%.h264" -hint -brand mp42 "%input%\..\%newname%_x264.mp4"
del "%input%\..\%newname%.h264"
 
GOTO end
 
:compEXR
set /P gamma="Set Gamma Value:"
:: ( gamma: gamma correction )
 
set endframe=%name:~-4%
set frame=%endframe:~0,-3%
 
if not %frame% == 0 GOTO 4digits
	set frame0=%endframe:~-3%
	set frame1=%endframe:~0,-2%
 
if not %frame1% == 00 GOTO 3digits
	set frame2=%endframe:~-2%
	set /a startframe=%frame2%-%number%+1
 
GOTO next
 
:3digits
set /a startframe=%frame0%-%number%+1
 
GOTO next
 
:4digits
set /a startframe=%endframe%-%number%+1
 
:next
 
popd
 
set "var=%newname%%%04d%ext%"
 
pushd "%installpath%"
	FOR /F %%k in ( 'mediainfo --Inform^=^"Image^;%%Width%%^" "%shortpath%\%file%"' ) do set Width=%%k
	FOR /F %%l in ( 'mediainfo --Inform^=^"Image^;%%Height%%^" "%shortpath%\%file%"' ) do set Height=%%l
	popd
 
if %Width% LEQ 1024 (
	set level=3.2
	set maxrate=4M 
	set bufsize=4M
	)
 
if %Width% GEQ 1280 (
	set level=4.1
	set maxrate=10M 
	set bufsize=10M
	)
 
if %Width% GEQ 1920 (
	set level=5.1
	set maxrate=20M 
	set bufsize=20M
	)
 
echo.
echo....................................................................
echo.....converting OpenEXR Sequence....................................
echo....................................................................
echo.
echo.Duration:  %Duration% Seconds
echo.Width:     %Width%
echo.Height:    %Height%
echo.
echo....................................................................
echo....................................................................
echo.
 
if exist "%input%\..\%~n1_tmp.avs" del "%input%\..\%~n1_tmp.avs"
 
echo ImageReader^( "%input%\%var%", start=%startframe%, end=%endframe%, fps=%fps% ^, use_DevIL = true) >> "%input%\..\%~n1_tmp.avs"
echo Levels^(0,%gamma%,255,0,255^) >> "%input%\..\%~n1_tmp.avs"
 
"%InstallPath%\ffmpeg.exe" -i "%input%\..\%~n1_tmp.avs" -pix_fmt yuv420p -c:v libx264 -preset %preset% -crf %quality% -g %GOPSize% -profile:v Main -level %level% -maxrate %maxrate% -bufsize %bufsize% "%input%\..\%newname%.h264"
 
if exist "%input%\..\%newname%_x264.mp4" del "%input%\..\%newname%_x264.mp4"
"%InstallPath%\mp4box" -add "%input%\..\%newname%.h264" -hint -brand mp42 "%input%\..\%newname%_x264.mp4"
del "%input%\..\%newname%.h264"
 
if exist "%input%\..\%~n1_tmp.avs" del "%input%\..\%~n1_tmp.avs"
 
:end
echo.
echo....................................................................
echo.
echo.....................converting done................................
echo.
echo....................................................................
echo.
 
ping 127.0.0.0 -n 3 >nul
echo.
echo Window close in 15
echo.
ping 127.0.0.0 -n 5 >nul
echo.
echo Window close in 10
echo.
ping 127.0.0.0 -n 5 >nul
echo.
echo Window close in 5
echo.
ping 127.0.0.0 -n 5 >nul
echo.

Mac automatisches Compile- Script für ffmpeg (nonfree)

(Anmerkung  vom 15.09.2015: das untere Script ist veraltet und es ist gut möglich dass es nicht richtig läuft. Eine neuere Version findet man unter: compile-ffmpeg-osx )

 

Ein Script mit dem man ffmpeg auf einem Mac compilieren kann. Es werden auch die libs faac und freetype verwendet, eine Weitergabe der Binaries ist dadurch ausgeschlossen. Das Script erstellt eine Ramdisk, wodurch das ganze Vorgang doch beschleunigt wird, die ffmpeg Binary wird anschließend in den Developer Ordner kopiert. Die Ramdisk kann manuell geschlossen werden, oder sie verschwindet nach dem nächsten Neustart. Befor das Script läuft muss Xcode und yasm installiert werden.
Vielen Dank an Sebastian Tischer! Von seiner Seite stammt der überwiegende Teil des Codes für das Script:
http://ffmpegmac.net/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
 
 
export CC=clang
export CC=gcc-4.2 #wahrscheinlich nur bei OSX 10.5.8 einsetzbar
 
DISK_ID=$(hdid -nomount ram://2097152)
newfs_hfs -v Ramdisk ${DISK_ID}
diskutil mount ${DISK_ID}
 
 
MES="/Volumes/Ramdisk/Sources"
TARGET="/Volumes/Ramdisk/sw"
CMPL="/Volumes/Ramdisk/compile"
 
 
mkdir ${MES}
cd ${MES}
 
 
curl -L -O http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
curl -L -O http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
curl -L -O http://download.videolan.org/pub/videolan/x264/snapshots/last_x264.tar.bz2
curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
curl -L -O http://downloads.sourceforge.net/project/freetype/freetype2/2.4.10/freetype-2.4.10.tar.gz
curl -L -O https://launchpad.net/ubuntu/lucid/+source/libgsm/1.0.13-3/+files/libgsm_1.0.13.orig.tar.gz
curl -L -O http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
curl -L -O http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
curl -L -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
curl -L -O http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2
curl -L -O http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
curl -L -O http://code.entropywave.com/download/orc/orc-0.4.16.tar.gz
curl -L -O http://downloads.us.xiph.org/releases/speex/speex-1.2rc1.tar.gz
curl -L -O http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
 
 
mkdir ${TARGET}
mkdir ${CMPL}
 
export PATH=${TARGET}/bin:$PATH
 
 
cd ${CMPL}
tar xzpf ${MES}/opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/orc-0.4.16.tar.gz
cd orc-0.4.16
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xjpf ${MES}/libvpx-v1.1.0.tar.bz2
cd libvpx-v1.1.0
./configure --prefix=${TARGET} --disable-shared && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/xvidcore-1.3.2.tar.gz
cd xvidcore
cd build/generic
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
rm ${TARGET}/lib/libxvidcore.4.dylib
 
 
cd ${CMPL}
tar xjpf ${MES}/x264-snapshot-*
cd x264-snapshot-*
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install && make install-lib-static
 
 
cd ${CMPL}
tar xzpf ${MES}/libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure --prefix=${TARGET} --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=/Volumes/Ramdisk/sw/include/ --enable-static --disable-shared && make -j 4 && make install
 
 
cd ${CMPL}
tar xjpf ${MES}/libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure --prefix=${TARGET} --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=${TARGET}/include/ --with-vorbis-libraries=${TARGET}/lib --with-vorbis-includes=${TARGET}/include/ --enable-static --disable-shared && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/speex-1.2rc1.tar.gz
cd speex-1.2rc1
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/libgsm_1.0.13.orig.tar.gz
cd gsm-1.0-pl13
mkdir -p ${TARGET}//man/man3
mkdir -p ${TARGET}//man/man1
sed "s/^INSTALL_ROOT.*$/INSTALL_ROOT=\/Volumes\/Ramdisk\/sw\//g" -i Makefile
sed "s/_ROOT)\/inc/_ROOT)\/include/g" -i Makefile
make -j 4
make install
 
 
cd ${CMPL}
tar xzpf ${MES}/faac-1.28.tar.gz
cd faac-1.28
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xzpf ${MES}/freetype-2.4.10.tar.gz
cd freetype-2.4.10
./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
 
 
cd ${CMPL}
tar xjpf ${MES}/ffmpeg-*
cd ffmpeg*
export LDFLAGS="-L${TARGET}/lib"
export CFLAGS="-I${TARGET}/include"
./configure --prefix=${TARGET} --enable-gpl --extra-libs='-lxml2 -lexpat -lfreetype' --enable-nonfree --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-libfreetype --enable-libfaac --enable-filters --arch=x86_64 --enable-runtime-cpudetect && make -j 4 && make install
 
 
cp ${TARGET}/bin/ffmpeg /Developer/ffmpeg
cp ${TARGET}/bin/ffplay /Developer/ffplay
cp ${TARGET}/bin/ffprobe /Developer/ffprobe
cp ${TARGET}/bin/ffserver /Developer/ffserver
 
echo files are in /Developer

FFmpeg Text einblenden und Video einfaden

Ein Beispiel wie man in ffmpeg Text in das Video einblenden kann. Ein FadeIn und FadeOut zu Schwarz ist auch mit dabei:

1
2
3
4
5
ffmpeg -i input.mov -vf drawtext="fontfile='C\:/Windows/Fonts/arial.ttf':text='erste ^
Reihe Text':fontsize=24:fontcolor=white:x=25:y=420, drawtext=fontfile=/Library/Fonts ^ 
/Optima.dfont:text='zweite Reihe Text':fontsize=30:fontcolor=white:x=25:y=460, ^
fade=in:0:30, fade=out:404:30" -s 384x216 -aspect 16:9 -sws_flags lanczos -y -vcodec ^
libx264 -pix_fmt yuv420p -an output.mp4

AppleScript mp4 Compression

Ein AppleScript mit dem man mehrere Files gleichzeitig in mp4 umwandeln kann. ffmpeg für Mac wird benötigt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
set filecount to 0
on open filelist
	set filecount to count filelist
 
	if (filecount = 2) then
		set the_array to {}
		repeat with i in filelist
			set filename to do shell script ¬
				"perl -e \"print quotemeta ('" & POSIX path of i & "');\""
			set end of the_array to filename
		end repeat
 
		set firstfile to item 1 of the_array
		set secondfile to item 2 of the_array
 
		set revChar to reverse of (characters of firstfile) as string
		set x to (offset of "." in revChar) + 1
		set outname to text 1 thru -x of firstfile
		set ext to text -4 thru -1 of firstfile
 
		if (ext = ".m2v" or ext = ".ac3") then
			tell application "Terminal"
				activate
				do script "/Applications/ffmpeg -filter:v yadif=0:0:0 -i " & firstfile & " -i " & secondfile & " -pix_fmt yuv420p -vcodec libx264 -crf 23 -preset slow -s 768x432 -sws_flags lanczos -acodec aac -strict experimental -ab 128k -threads 0 -y " & outname & "_x264.mp4"
			end tell
		end if
 
	else if (filecount = 1 or filecount > 2) then
 
		set the_array to {}
		repeat with i in filelist
 
			set filename to do shell script ¬
				"perl -e \"print quotemeta ('" & POSIX path of i & "');\""
			set end of the_array to filename & " "
		end repeat
		tell application "Terminal"
			activate
			do script "for j in " & the_array & "; do /Applications/ffmpeg -filter:v yadif=0:0:0 -i \"$j\" -pix_fmt yuv420p -vcodec libx264 -crf 23 -preset slow -s 768x432 -sws_flags lanczos -acodec aac -strict experimental -ab 128k -threads 0 -y \"${j%.*}\"_x264.mp4; done"
		end tell
	end if
end open
 
if filecount < 1 then
	display dialog "Please Drag and Drop one Video Files or one Video and one Audio File for Compression in MP4 x264 on it!"
	return
end if