Hello,
I have a folder with 35k videos, I want to replace the first 5 seconds of each video in the folder with a specific intro and place a watemark on top left for all the video. Videos have different lenght.
The resulting video should replace the previous one under the same name without any additional character to the name.
Do you guys know if this is possible with AviSynth and how to do that?
+ Reply to Thread
Results 1 to 10 of 10
-
-
You really want to reencode 35,000 videos just to add an intro (which can be done by using the playlist feature of most players) and add an ugly watermark (which can perhaps be done using a subtltle)?
And I don't suppose all 35,000 videos are of the same resolution and format? If not, I'd say 'fuggedaboutit'. -
Sure it's possible with AviSynth, a batch file, and an encoder like ffmpeg. You want to REPLACE the first 5 seconds with an intro? Or pre-pend the intro. Are all the videos the same resolution, frame rate, etc.? What about audio? Keep the original audio? Replace the first 5 seconds with the intro's audio? Same watermark on all videos? Watermark over the intro too or only after the intro?
I would highly recommend you place the new videos in a separate folder and keep the old ones in case there's a problem. -
- Yes I want to replace. Keeping the original audio it's fine
- Don't think they are all the same resolution and framerate, but I'm fine with forcing a resize @ specific bitrate on all of them
- Yes same watemark on all videos. Only after the intro but if this is not possible, having it over the intro would be fine as well -
Here's a batch file and a script: _batch.bat and _script.avs. The batch file steps through each file in a subfolder called Source. It builds a one line script that opens the video file (_GetSource.avs). _script.avs imports that script and processes the video. The Assets subfolder should contain logo.bmp and intro.mp4 -- used by _script.avs to add the logo and replace the first part of the video file with the intro. ffmpeg is then used to encode (you may want to change the codec, preset, and other settings) _script.avs and copy the original audio from original mp4 file. Finally, the result is written to the subfolder Output. The output is the same name as the original input file.
Note that the intro video is resized to the same size and frame rate as the source video. If the aspect ratios are different the intro will be distorted. If the frame rates are different the logo may get jerky.
If you really want to replace the original videos you can render to a temporary file name, delete the original mp4, then rename the temporary file to the original name. If you do this you will want to verify that the ffmpeg encoding succeeded properly before deleting the original file. -
Damn! I didn't expect to receive the actual script, you are a hero! Do you have skype/telegram/discord?
-
Hi, finally I'm testing the script but I'm getting this error, do you have any idea why? Please note that I emoved line 5 and 6 because I do not need the logo watermark anymore, I only need to add the intro now
EDIT: I tried to search online and someone was saying ffmpeg could be the issue. I tried to install an old version (4.0.2) and now I get a different error, don't know if this could help
[avisynth @ 063e4340] Script error: there is no function named "LSMashVideoSource"
(_GetSource.avs, line 1)
(_script.avs, line 1)
_script.avs: Unknown error occurredthere is no function named LSMASHVideoSourceLast edited by giggioman00; 18th Oct 2022 at 11:32.
-
You need to install the LSMASH package for AviSynth: http://avisynth.nl/index.php/LSMASHSource
Put a copy of LSMASHsource.dll in AviSynth's plugins folder. Be sure to use the right "bitness", the one from the x86 folder for 32 bit AviSynth, and/or the one from the x64 folder for 64 bit for 64 bit AviSynth. And be sure to use put it in the correct plugins folder, plugins for 32 bit AviSynth+, plugins64+ for 64 bit AviSynth+. -
I carefully followed your instruction for at least 3 times but with no success, same errors happens
EDIT: Apparently if I rename _script.avs to _script.avsi it works. I read if it is .avsi the plugins are loaded automatically.
But now I'm having problem with encoding apparently. A 200 MB file was encoded into 14 MB file. Also I need to press a key to encode the next file, it is not automatic
EDIT 2: The output files doesn't open
EDIT 3: I was able to encode the files succesfully by fixing the mmpeg command in the batch. Now I need help to pass to the next file without having to press a key please...
EDIT 4: I was wrong. The file appears in output folder after the encoding but the intro doesn't appear at the start of the video...Last edited by giggioman00; 18th Oct 2022 at 15:10.
-
That makes no sense. The batch file uses ffmpeg to open the AVS script. If you rename it to avsi ffmpeg will fail and the batch file will fail to produce any ouput.
You can specify higher quality for the x264 encoding to get a bigger (higher quality) file (lower crf value). You might also want to specify a higher quality preset like medium, slow, or slower (of course processing will be slower).
Delete the line that says "pause" from the batch file. I put that in there for debugging purposes (so one could see what was happening for each file).
My guess is you didn't "fix" the ffmpeg command line properly. With batch processing there tons of little things that can go wrong. The batch and script were meant as general guides, not the final versions you will be using.
I was just guessing at a lot of things like the size of your videos, the intro, and watermark. If you can't figure it out for yourself, upload a few sample videos, your logo image, and your intro video so I can tune the process.
Similar Threads
-
Avisynth add grain plugin
By WAusJackBauer in forum EditingReplies: 3Last Post: 4th Dec 2021, 22:01 -
ffmpeg cut off first 10 seconds of video then add intro 15 seconds in
By PeterWall in forum Newbie / General discussionsReplies: 2Last Post: 30th Jul 2020, 06:18 -
Batch add intro to Videos using FFMPEG
By dexterfox44 in forum EditingReplies: 2Last Post: 10th Jun 2020, 19:32 -
Vegas Pro 14. Add Intro to video without massively enlarging the file
By bustee in forum Newbie / General discussionsReplies: 12Last Post: 26th Mar 2020, 21:05 -
avisynth how to add borders ??
By marcorocchini in forum Newbie / General discussionsReplies: 121Last Post: 5th Mar 2018, 16:59