Watermark embedded into video
-
Hello,
Can this plugin embed a watermark to video uploaded video files?
Thank you.
-
Yes, but you’ll need to have FFMPEG installed on your server in order to do it. https://ffmpeg.org/download.html
Most shared hosts do not allow you to install FFMPEG because it uses a lot of system resources.
Hello,
I have FFMPEG installed. I have a watermark set in “Add watermark to encoded files:”, however the video itself isn’t watermarked, the watermark hovers over it and I can access the file through looking at the HTML code and it’s not watermarked there.
The video needs to be encoded correct? I’m not sure what I need to turn on to enable watermarking the video file.
Is this correct? https://i.imgur.com/ElRaIyW.pngThank you.
- This reply was modified 1 year, 11 months ago by Jack.
Yeah, the video needs to be encoded in order to add the watermark. Enable that top format (Replace original with same resolution H.264). I don’t recommend encoding WEBM VP8 or OGV anymore, but your needs may vary of course.
Hello,
I’m getting the following error, after turning on Replace original with same resolution H.264:
thrown in /jack/wordpress/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 1098 [05-Dec-2022 17:50:03 UTC] PHP Fatal error: Uncaught ValueError: Path cannot be empty in /jack/wordpress/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php:1098 Stack trace: #0 /jack/wordpress/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php(1098): fopen() #1 /jack/wordpress/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php(7783): kgvid_url_mime_type() #2 /jack/wordpress/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php(6295): kgvid_enqueue_videos() #3 /opt/jack/wordpress/wp-includes/class-wp-hook.php(307): kgvid_cron_new_attachment_handler() #4 /opt/jack/wordpress/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters() #5 /opt/jack/wordpress/wp-includes/plugin.php(524): WP_Hook->do_action() #6 /opt/jack/wordpress/wp-cron.php(188): do_action_ref_array() #7 {main} thrown in /jack/wordpress/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 1098
Has this ever happened? I’m going to try and debug it.
Thank you.
UPDATE: I was inserting attachments wrongly.
- This reply was modified 1 year, 11 months ago by Jack.
@kylegilman Hello,
I’ve been digging in the code trying to find why watermarking isn’t working for me and by dumping some variables I found out the
$video
variable in function kgvid_encode_videos had the movieurl missing a slash, so it’s the fullpath then the name of the file without a slash before the name.I went into the function kgvid_encodevideo_info and added a slash at the end of
$encodevideo_info['encodepath'] = $uploads['path']
so it’s$encodevideo_info['encodepath'] = $uploads['path'] . '/' ;
now.Suddenly many files started encoding, probably held up in que queue and got executed by a cron job.
Now the problem it’s trying encode from file names with ‘-fullres’ concatened at the end and those don’t exist so the encode.txt files read:
ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 10 (Debian 10.2.1-6) configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-fil> libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 : No such file or directory
It’s also looping, trying to encode the file.
I would not recommend adding that
/
there since it’s added in a few lines down at$encodevideo_info['encodepath'] = $path_parts['dirname']."/";
but only if the file is an attachment in the WordPress Media Library. Are you hosting the files outside of the WordPress Media Library?Edit: Actually it might be the right place to put it in this case. I need to do some more testing with non Media Library files. Either way you should clear your encode queue and wp-cron if possible.
- This reply was modified 1 year, 11 months ago by Kyle Gilman.
Are you hosting the files outside of the WordPress Media Library?
Yes, exactly. I’m using forminator to upload files from the front-end.
Ok, got it working. I just needed to generate attachment metadata with
wp_generate_attachment_metadata( $attachment_id, $image_path );
for the uploaded files. Videos are now encoded and watermarked.That’s good news! I think you found an edge case that I need to troubleshoot though. You should be able to encode files that don’t have attachment metadata.
@kylegilman I’m still having an issue where replacement of the original file with with the encoded fullres one takes a long time or sometimes doesn’t happen.
I think it’s was the browser cache, it seems i replaces always but takes some time. I’m running wp-cron.php every minute, and it takes sometimes up about 3 minutes (not sure why) for kgvid_cron_queue_check to run and for kgvid_replace_video to be called. Since the encoded video is complete much earlier, I’m trying to look for a waiy to call kgvid_replace_video right when fullres encoding is complete because in my case I don’t want the video pulished before it’s fully watermarked.
@kylegilman When I upload a webm file, the fullres mp4 file is created from it, but the webm file isn’t replaced, instead it seems a .mp4 file is created without the webm extention. The Video.js v7 still displays the old webm file without the watermark, instead of the mp4 file. I have the ‘Default playback resolution’ set to automatic.
If I turn gallary more on
gallery="true"
in the KGVID shortcode, then the watermarked mp4 will play and in the HTML code will have:<video id="video_kgvid_1_html5_api" playsinline="playsinline" autoplay="" preload="metadata" poster="https://www.example.com/wp-content/uploads/2022/40/example_thumb2.jpg" class="vjs-tech" tabindex="-1" role="application"> <source src="https://www.example.com/wp-content/uploads/2022/40/example.mp4?id=1" type="video/mp4" data-res="480p"> <source src="https://www.example.com/wp-content/uploads/2022/40/example.webm?id=1" type="video/webm" data-res="WEBM VP8"></video>
- This reply was modified 1 year, 11 months ago by Jack.
UPDATE: I had set to auto publish by default on formiantor, so posts created from it would be set to publish by default. Turning this off fixed the issue I was having with the original webm file not being replaced with the encoded file!
Now I’ve set to auto publish when all files are encoded from vidropacks settings and all seems to work.
Thank you.
- The topic ‘Watermark embedded into video’ is closed to new replies.