Click on the " Python Artificial Intelligence Technology above to follow, star or stick to the top
Pushed on time at 22:24, delivered as soon as possible
Reply to the " big gift package " in the background and send you special benefits

Editor: Lele | From: Python Artificial Intelligence Programming

Pythn artificial intelligence technology (ID: coder_experience) 902th tweet

Previous: Python downloads large files, which method is faster


text


Hello everyone, I am Python artificial intelligence technology

Abstract of this article:

Through simple Python technology, 10,000 videos that can be passed through the video number to be deduplicated are realized, so as to obtain the video number traffic.


Suppose a video has 100 exposures and 10,000 videos, that is, 100w exposures. Winning by quantity will make you no longer worry about traffic. 


The codes that appear in this article will be provided to you in full at the end of the article, so that you can start making money projects through the [copy + paste] method.

Friends who pay attention to Wangzhuan should have some understanding of video account delivery. Similar to other platforms, you can publish a video, introduce a product, and hang a recommended purchase link. When a user buys a product through your promotion link, you can Going to money, it's intuitive, isn't it.

From other big V bloggers on the Internet, I took some pictures of the income of making video accounts with goods

picture

Why is everyone starting to roll up video numbers now? The main reason is that the video account has begun to release traffic, and the WeChat traffic is so large, so there are obvious dividends, which is a good opportunity for ordinary people.

Well, if you promote how awesome and worthwhile the video account is, this is the place to go. Personally, I am more optimistic.

Knowing the background, let's talk back to the technology.

Can we take advantage of technology to get a head start on video accounts?

Of course you can, and you can get some traffic through the content in my book ("Python Office Automation"). Next, I will combine some of the knowledge points mentioned in "Python Office Automation" to actually combat a project that can get traffic. , the flow is about the same as cash.

Where is the traffic?

By simply summarizing the content discussed by seniors and experts, we can draw some valuable conclusions:

  • 1. Content that has been popular on other platforms will inevitably become popular again on the video account.
  • 2. We can use the quantity to combat the uncertainty of the platform traffic recommendation algorithm.
  • 3. The short video platform will de-emphasize the content, but will not de-emphasize the sound.

Then using technology to manually generate videos that have undergone platform repeatability verification in batches is a good solution. Combining the previous three conclusions, we can get the following specific steps:

  1. Observe the popular videos on other platforms, such as funny jokes on Douyin, beautiful dancers, etc., and divide and organize the production steps of these videos.
  2. Use the program to generate silent videos in batches according to the production steps, and publish them in multiple accounts, to counteract the uncertainty of the platform algorithm with quantity, and make the acquisition of traffic a deterministic thing.
  3. To get the sound from the same kind of video, because the platform will not de-emphasize the sound, you can use it directly and match it to your own video. Because it is a similar video, there will be no strong sense of violation.

From a variety of popular videos, I found a more difficult example as a demonstration. Based on this example, I wrote the code. When you follow my code to develop your own project, it will be simpler, isn't it very considerate?

Here, I choose to generate a chat video, similar to the following picture:

picture

Searching for this kind of video on Douyin, you will find that the likes are very high, and the exposure must be incredible.

Hmmmm, I know that there are other popular ones recently, such as videos of traditional Chinese medicine , videos of naming , and videos of data display .

picture

These categories are very popular, and traditional Chinese medicine videos have been popular on the video account in the past few weeks, and many friends around have made money on it.

However, this article is a technical article, so I still choose to generate a more difficult chat and funny video, understand the principle of generating this type of video, and you will experience the pleasure of killing chickens with a knife when generating other videos.

Let’s take a look at the difficulties of generating chat and funny videos:

  1. To obtain high-quality funny chat data, you need to use crawler technology, and high-quality chat data is usually chat pictures, so you need to use OCR (text recognition) technology to get the content in the picture
  2. Generate WeChat chat pictures based on funny chat data, not just simple stitching of pictures
  3. Get a lot of similar videos on Douyin, get the sound in the video, and need crawler technology

Compared with other types of videos, chat videos are more difficult to generate. For example, traditional Chinese medicine videos do not need to use OCR technology. It is enough to crawl pictures of old Chinese medicine practitioners, and then simply stitch them into videos. The same is true for other types of videos.

Now, let's do it step by step.

retrieve data

The first step, we need to obtain data, simple Baidu: keywords such as [funny dialogue], [funny jokes] will search for websites, but the content of these websites is of low quality, and many have no logic or lack of data.

Another way of thinking, searching for pictures of [Funny Chat Conversation], you can get relatively high-quality conversation data, as shown below:

picture

These pictures are generally derived from real chat data, so the quality is relatively high, and it is indeed more interesting.

After finding the data, we can write code to crawl it down. To implement this crawler program in Python, first of all, you need a little Python foundation. These contents can be found in Chapters 2 and 3 of the book "Python Office Automation". get.

picture

After reading the basic part, you can directly see the content related to automatically obtaining website information in the book (the first subsection of Chapter 9 of "Python Office Automation").

picture

After this section, you will get the background knowledge of crawler and you can start writing code.

Don't worry, here I have prepared the code for crawling Baidu pictures for you (the complete project code is at the end of the article).

picturepicturepicturepicturepicturepicture

Niubi! N open source projects necessary for private life! Hurry up to collect

picture

With the knowledge of chapters 2, 3, and 9 in the book, it is not a big problem to understand the code. Although the knowledge is only that, but to use it flexibly, you still need to practice more.

The obtained pictures are as follows:

picture

If we want to generate TCM videos, the same is true. Search for [Traditional Chinese Medicine Master] in Baidu Pictures, and then crawl the pictures.

Compared with traditional Chinese medicine videos, chat videos are more difficult. Obtaining chat pictures is only the first step. We also need to extract text information from pictures. For other types of videos, after obtaining pictures, videos can be generated directly. .

After the chat picture is obtained, it is necessary to extract the information from the picture. We can find the OCR-related interface on the Internet. Here I use an OCR project I developed: imgocr.

Based on the imgocr project, you do not need to find a third-party OCR API, because the OCR model built into the project:

picture

The imgocr project involves operations such as reading and saving image files. See Chapter 8 of "Python Office Automation" to better understand these codes.

picture

After running this project, you can get this effect.

picture

At this point, high-quality chat data is ready.

Generate chat video

Videos are all composed of pictures, as long as a batch of pictures is generated, and then the pictures are spliced ​​together, it becomes a video.

So how do we convert chat data into chat pictures? And chat is a dynamic process, that is, you say a sentence, I reply, so you can't directly generate a complete picture, but you need to generate a picture in the chat, and then stitch it together.

First of all, we need to find a tool for producing WeChat chat pictures, Baidu search [WeChat chat picture generation], we can find many tools to generate WeChat chat pictures, many WeChat merchants will use such tools to generate chat screenshots of customer transactions:

picture

Based on the content of Chapter 9 of "Python Office Automation", you can automatically control the browser, and then obtain the generated WeChat screenshots.

picture

Suppose there are 10 dialogues in a picture, then we need to generate 10 pictures, and then use these 10 pictures to generate videos. Now we want to generate 1w videos, then we need to request this website 10w times, because the website belongs to someone else, There are usually limits that keep us from making large requests. then what should we do?

If you have read Chapter 9 of the book, you will know that the website is mainly constructed of HTML, CSS and JS. Download these files to the local, you will also Similar sites are available.

You can manually save the files used by the website one by one, or you can use the program to save them with one click. It is recommended to use a browser plug-in called Save All Resources, which allows you to save all the elements of the website with one click. When "referencing" other people's websites, Very useful tool.

picture

I found a tool website generated by WeChat chat, used Save All Resources to scrape all the website information, and then used Python to build the website. The code is as follows:

picture

Run the code, and you can get a website of WeChat chat generation tool locally. In addition, search the top technology background of the official account and reply "API interface" to get a surprise gift package.

picture

How you use your website is up to you. WeChat search public number: Java project selection, reply: java to receive information.

还是利用《Python自动化办公》第9章的内容,控制我们自己的网站,然后将OCR识别的数据,再以图片的形式生成出来。

以书籍中的内容为基础,简单写写自动化代码,便可生成相应的图片:

picture

然后基于这些图片,便可以合成视频了。

picture

下一步就将声音合成上去吧。

获取音频

合适的音频是提高视频感官很重要的一步,那怎么找合适的音频呢?

回顾一开始说的结论:短视频平台对内容会去重,但对声音不会去重。

所以,我们可以直接去短视频平台上,下载同类视频他们的音频。

这里同样,给大家准备好了下载抖音视频的代码,运行代码,将抖音主播个人首页中的链接复制到程序中,便可以批量下载了:

picture

下载的素材如下:

picture

其实,下载程序可以直接下载视频的音频,但考虑到大家日后还是有从视频中提取音频的需求,所以还是自己来实现。

对Python而言,使用moviepy库提取音频,三行代码就搞定了:

from moviepy.editor import AudioFileClip
my_audio_clip = AudioFileClip("my_video.mp4")
my_audio_clip.write_audiofile("my_audio.wav")

我们要处理多个视频,套个循环,便可以解决问题了。picture

生成最终的视频

最后,便是将生成的视频和抽取出的音频整合在一起。我随机选择一个音频来搭配视频,从而获得一个完整的视频

picture

下图中,带有sound便是生成后,带有声音的完整视频。

picture

其实,还有一些可以做的,比如,用剪映做一下开头和结尾的视频,比如引导关注或引导点击购物车等,我们生成的视频,可以在首尾都加上这些视频。

结尾

这就是本文的所有内容了.


picture

欢迎有需要的同学试试,如果本文对您有帮助,也请帮忙点个 赞 + 在看 啦!❤️

在 GitHub猿 还有更多优质项目系统学习资源,欢迎分享给其他同学吧!

你还有什么想要补充的吗?

免责声明:本文内容来源于网络,文章版权归原作者所有,意在传播相关技术知识&行业趋势,供大家学习交流,若涉及作品版权问题,请联系删除或授权事宜。


技术君个人微信


添加技术君个人微信即送一份惊喜大礼包


→ 技术资料共享

→ Technical exchange community


picture


--END--


Hot texts from the past:

Look at the property management system of others, it is called an elegant (with source code)

A software for immortals to take private work, it is too much to hang!

Nanny level! Take you to build a server!

What is going on with the "cutting off EDA supply" in the United States?

98 transfers out and 0 transfers in, 985 colleges and universities civil engineering has become a "tiankeng", attracting heated discussions

Musk's salary exceeded $10 billion last year

17 useful Python tips to share!

Because the Internet package is too spicy, my brother spent 980,000 to build a fiber-optic network and contracted 70 residents in the village to access the Internet

50 lines of Python code to crawl high-definition picture of black silk crush

GitLab Disable Windows!

The best combination for writing Python code on Windows!


The " Four Great Books " of Deep Learning for Python Programmers :


picture


These four books are really good! We all know that there are too many materials for machine learning and deep learning. In the face of massive resources, we often fall into the confusion of "no way to start". And not all books are high-quality resources, and wasting a lot of time is not worth the effort. I recommend these good books to everyone and give a brief introduction.


ways to obtain:

1. Scan the code to follow this official account
2. Backstage reply keyword: famous book

picture

▲Long press to scan to follow and reply to the famous book to get it