Bot promotion by 214 thousand percent

Since about the beginning of December, I have been conducting an experiment to promote (hype, if you like) on Twitter for my bot. I like the results. Perhaps someone will be interested in how to make an effective online advertising campaign with almost zero budget. Screenshots, statistics, code parts and stories below. 





Theory 

In my opinion, online advertising will soon actively master short sound spots. Increasingly, people are starting to listen to the Internet, and not just watch it. Internet radio, Spotify, iTunes, and a host of other wiretap services are rapidly becoming mainstream. Even Twitter brought audio tweets to the market. The growth in the value of sound is also facilitated by the growth in the number of individual listening devices - headphones have become commonplace, which means that sound advertising can be individualized and served to an individual, depending on his preferences, like traditional contextual advertising.  





Practice 

I already wrote about my bot for sound in an article on Habr .





At the beginning of December, I added the function of voice acting for gifs and pictures to it. That is, you need to send the bot an image as a file, and then a voice message. The bot will return a short video spot that can be inserted anywhere. We experimented with posting finished videos on Twitter to gauge user reaction and "engagement".  





In order for the bot to work correctly on the social network, some problems were found and fixed during testing. In particular: 





  • Time trimming. 





  . , - , , , . "" . : 





.





/ ffmpeg





PWF



-->





cmd



--> system



python os











connect_video_voice



, .





.









def connect_photo_audio(self,imagepath, audiopath, name=urandom(30).hex()):    
  targetvideotype = "mp4"    
  cmd(f'ffmpeg -y -loop 1 -i "{imagepath}" -i "{audiopath}" -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pixfmt yuv420p -shortest -vf "scale=trunc(iw/2)2:trunc(ih/2)2" "{self.PWF}/{targetvideotype}/{name}.{targetvideotype}"')    
  return f'{self.PWF}{targetvideotype}/{name}.{targetvideo_type}'
      
      







def connect_video_voice(self,videopath, audiopath, name=urandom(30).hex(),):
  sourcevideotype = "mp4"
  cmd(f'ffmpeg -streamloop -1 -i "{videopath}" -i "{audiopath}" -shortest -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 -y "{self.PWF}/{sourcevideotype}/{name}.{sourcevideotype}"')    
  return f'{self.PWF}/{sourcevideotype}/{name}.{sourcevideo_type}'
      
      



, , , .





f"ffmpeg -stream_loop -1 -i "{video_path}" -i "{audio_path}" -shortest -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 -y "{self.PWF}/{source_video_type}/{name}.{source_video_type}"
      
      



  •  





     





, :  





PyTelegramBotAPI





, message.voice



. duration



, .





if message.voice.duration > 60:
  self.BOT.send_message(message.fromuser.id, "Your message too long. Max size of message: 1 minute")    
  return
      
      



 

"" . - , . "" .   .  





.  









, .   





get_users_graphic__activity__



, /activity .





, /activity , helper, .





create_graphic_activity



--> , .





limit



--> , . limit







/activity 3 3 .





def get_users_graphic__activity__(self):
    if self.MESSAGE.chat.id in HELPERS or self.MESSAGE.chat.id == ADMIN_USER_ID:
        graphic = create_graphic_activity()
        if graphic:
            try:
                limit = int(re.sub('\D', '', self.MESSAGE.text))
            except Exception:
                limit = 7
            self.BOT.send_photo(self.MESSAGE.chat.id, photo=create_graphic_activity(limit=limit))
        else:
            self.BOT.send_message(self.MESSAGE.chat.id, LANGUAGES["commands"]["server_crashed"])
    else:
        self.BOT.send_message(self.MESSAGE.chat.id,LANGUAGES["commands"]["you_not_have_permissions"])

      
      



. - . , .  





Perhaps some advertisers can already use my bot to promote their products and services. You can include your logo or product image in the picture or add a sound message with a slogan. I will continue to improve the functionality of the program for now. In the near future, I plan to supplement the bot with sound leveling functions and overwriting takes. While it is not difficult to add the code for re-recordings of takes, the equalization of the sound power is a non-trivial task, since for advertising purposes it is the change in the sound power that can be the "catching" factor. 








All Articles