Adding Logo to a Video in VLC Player using Command Line

Adding Logo to a Video in VLC Player using Command Line

Adding a logo to a video may require some video editing skills. You can find in the Internet tons of FREE video editing software where in the end lets you buy the product to use its full functionality. If it’s really a must then one might consider buying it.

But spending hundreds of dollars in buying a video editing software isn’t really ideal. Yes, if your purpose is only to add a logo to a video, maybe twice or thrice. That isn’t worth your investment.

You might have heard or probably used VLC media player to play music or movies on your computer. We are talking here about adding a logo and video editing but you might ask me why am I talking about VLC media player.

It’s because VLC can save you time and money. The player actually have the feature that allows you to add an Overlay text or image to your video particularly a logo.

The feature can be accessed via Tools > Effects and Filters and the following window will pop-up and do the following:

  • Select the Tabs Video Effects > Overlay
  • Check the Add logo checkbox
  • Click the Button next Logo textbox field and browse the logo you want to add to your video
  • Adjust the Top and Left position where you want the logo to appear
  • Then adjust the transparency so it won’t really affect the viewing experience

VLC Video Effects add overlay logo

Then you have to follow some other steps to make your changes permanent which I won’t be discussing here.

Look, those were a lot of tasks to do in the User Interface. A lot of options and settings to check which can make the hours you spent useless if you’re not familiar what are those for.

Aside from the user interface, those steps we did above actually have an equivalent command which can be run through the VLC’s CLI or Command-Line Interface.

I did a little searching and was able to find a solution in VLC’s support page about how to run the commands such as the following:

[code]vlc –logo-file logo-small.png video.mp4 –play-and-exit –sout “#transcode{vcodec=h264,vb=1500,width=1280,height=700,acode=mp3,ab=128,channels=2,samplerate=44100,sfilter=logo}:std{access=file,dst=new_video.mp4}}[/code]

The above command does the following:

  • Sets the –logo-file parameter to logo-small.png
  • Sets the filename of the source video which is video.mp4
  • –play-and-exit closes the VLC player when it’s done processing the video
  • Sets the video and audio codec options
  • The sfilter=logo, is important as it tells the program to enable the logo filter option
  • Finally, set the filename of the video output that is new_video.mp4. The output filename must not have any spaces or special characters in it, you can use underscores (_) or dashes (-) instead.

Note: You must add your VLC installation folder first into the system environment variables “Path” so that the VLC’s CLI will become available in the command prompt.

Though the above command is working for me, I found it daunting somehow because all of the files (logo, video source and video output) have to be in the same folder. Which I think isn’t really good as it’s going to mix up everything.

A batch file solution

So, I created a batch file script which can simplify the process. What it does is that it will only prompt the user to enter the path of the logo, input and output video’s file name.

Add Logo to video in VLC using command line

Before we proceed, open any text editor like Notepad then copy and paste the following codes in it and save it as “addLogo.bat” in an easily accessible location such as on “C:/videos/with-logo”. You can name it whatever you want as long as the extension is .bat like (yourname.bat).

[code]

@echo off

rem The following is the sample command that we’re going to use in our batch file
rem vlc –logo-file logo-small.png video.mp4 –play-and-exit –sout “#transcode{vcodec=h264,vb=1500,width=1280,height=700,acode=mp3,ab=128,channels=2,samplerate=44100,sfilter=logo}:std{access=file,dst=new_video.mp4}}

GOTO promptLogo

:promptLogo
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
set /p logo=++ Path to Logo:

IF “%logo%”==”” GOTO promptLogo

goto promptVideo

:promptVideo
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
echo ++ Your Logo is: “%logo%”
echo ++
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
set /p video=++ Path to Video:

IF “%video%”==”back” goto promptLogo
IF “%video%”==”” GOTO promptVideo

goto destVideo

:destVideo
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
echo ++ Your Logo is: “%logo%”
echo ++ Your Video is: “%video%”
echo ++
echo ++ Type back to go 1 level up
echo ++
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
echo ++ Note: The file name of the video must have no spaces. Use Underscores (_) or hyphens (-) instead.
echo ++
set /p dest=++ Enter the name of video to be created:

IF “%dest%”==”back” goto promptVideo
IF “%dest%”==”” goto destVideo

:check
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
echo ++ Your Logo is: “%logo%”
echo ++ Your Video is: “%video%”
echo ++ Your New Video is: “%dest%”
echo ++
echo ++ Type back to go 1 level up
echo ++
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
set /p proceed=++ Is everything correct? Type Y/N:

IF “%proceed%”==”” goto check
IF “%proceed%”==”N” goto destVideo
IF “%proceed%”==”n” goto destVideo
IF “%proceed%”==”Y” goto processVideo
IF “%proceed%”==”y” goto processVideo

:processVideo
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo ++
echo ++ Your Logo is: “%logo%”
echo ++ Your Video is: “%video%”
echo ++ Your New Video is: “%dest%”
echo ++
echo ++ Please wait while your video is being processed…
echo ++
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
vlc –logo-file “%logo%” “%video%” –play-and-exit –sout “#transcode{vcodec=h264,vb=1500,width=1280,height=700,acode=mp3,ab=128,channels=2,samplerate=44100,sfilter=logo}:std{access=file,dst=”%dest%”}}

pause

set /p next=Do you want convert another video? Type Y/N:

IF “%next%”==”Y” goto promptLogo
IF “%next%”==”y” goto promptLogo
IF “%next%”==”N” goto END
IF “%next%”==”n” goto END

goto promptLogo

:END
exit

[/code]

The logo and input video can be in any location in your computer while the output video must be in the same location where you save the above batch file. If you save the batch file in “C:/videos/with-logo”, then all your output videos will be saved there.

Cromwell Bayon

He is a self-tutored programmer and a Full-Stack Developer. He strives to excel in the newest technology as possible. He has a very high sense of technicality and analytical skills which allows him to resolve any kind of issues related to technology. He also loves woodworking. Read more about him here...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.