Skip to content

Commit a9b9862

Browse files
adding concat example, removing forgotten printing text
1 parent 895d984 commit a9b9862

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

examples/concatenate.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,50 @@
2323
// The number of threads that FFMpeg should use
2424
] );
2525

26+
$clip1 = $ffmpeg->open( new \Sharapov\FFMpegExtensions\Input\File( getcwd() . '/examples/source/demo_video_720p_HD.mp4' ) );
27+
28+
// Create complex filter collection
29+
$options = new \Sharapov\FFMpegExtensions\Filters\Video\FilterComplexOptions\OptionsCollection();
30+
31+
// Create drawtext option 1
32+
$text1 = new \Sharapov\FFMpegExtensions\Filters\Video\FilterComplexOptions\OptionDrawText();
33+
$text1
34+
// Set z-index property. Greater value is always in front
35+
->setZIndex(160)
36+
// You can use fade-in and fade-out effects. Set time in seconds
37+
->setFadeIn(2)
38+
->setFadeOut(2)
39+
// Set font path
40+
->setFontFile(new \Sharapov\FFMpegExtensions\Input\File(getcwd() . '/examples/source/calibri.ttf'))
41+
// Set font color. Accepts transparency value as the second argument. Float value between 0 and 1.
42+
->setFontColor('#ffffff')
43+
// Set font size in pixels
44+
->setFontSize(33)
45+
// Set text string
46+
->setText('php-ffmpeg-extensions>library')
47+
// Coordinates where the text should be rendered. Accepts positive integer or
48+
// constants "(w-tw)/2", "(h-th)/2" to handle auto-horizontal, auto-vertical values
49+
->setCoordinates(new \Sharapov\FFMpegExtensions\Coordinate\Point(\Sharapov\FFMpegExtensions\Coordinate\Point::AUTO_HORIZONTAL, 50))
50+
// Set timings (start, stop) in seconds. Accepts float values as well
51+
->setTimeLine(new \Sharapov\FFMpegExtensions\Coordinate\TimeLine(1, 20));
52+
53+
// Pass option to the options collection
54+
$options
55+
->add($text1);
56+
57+
// Apply filter options to video
58+
$clip1
59+
->filters()
60+
->complex($options);
61+
2662
$collection = new \Sharapov\FFMpegExtensions\Media\VideoCollection();
2763

64+
// Adding clips to the collection
2865
$collection
29-
->add( $ffmpeg->open( new \Sharapov\FFMpegExtensions\Input\File( getcwd() . '/examples/source/demo_video_720p_HD.mp4' ) ) )
66+
->add( $clip1 )
3067
->add( $ffmpeg->open( new \Sharapov\FFMpegExtensions\Input\File( getcwd() . '/examples/source/intro_720p_muted.mp4' ) ) );
3168

69+
// And do concatenation
3270
$format = new \Sharapov\FFMpegExtensions\Format\Video\X264();
3371
$format->on( 'progress', function ( $item, $format, $percentage ) {
3472
print 'Done: ' . $percentage . "%\n";

src/php-ffmpeg-extensions/Filters/Video/FilterComplexOptions/OptionDrawText.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ public function getCommand() {
319319
$fadeTime = '';
320320
}
321321

322-
print_r( $fadeTime );
323-
324322
// Bounding box
325323
if ( $this->_boundingBox != null ) {
326324
$options[] = "box=1:" . implode( ":", $this->_boundingBox );

0 commit comments

Comments
 (0)