Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of creating M3U playlist in Linux terminal

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article shows you how to create M3U playlists in Linux terminals. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can gain something through the detailed introduction of this article.

Following the method described below, you can create M3U playlists in the Linux system terminal to enable sequential playback, rather than random playback. Background

Some playback files may not be saved in order. Under Linux, files are not sorted naturally in numerical order, so I had to create a .m3u playlist so that the MPV video player can play videos in order instead of at will.

Similarly, sometimes the number indicating the episode is in the middle or end of the file name, like "My Web Series S01E01.mkv". The show information here is in the middle of the file name, and "S01E01" tells us that this is the first episode, followed by other episodes.

So all I have to do is create a .m3u playlist in the video list and tell MPV to play the .m3u playlist, and MPV will naturally play the videos in order.

Definition of M3U file

M3U is basically a text file that contains file names in a specific order. When a player such as MPV or VLC opens an M3U file, it attempts to play the specified file in the given order.

Create an M3U to play audio or video files sequentially

As far as I'm concerned, I used the following command:

$/ home/shirish/Videos/web-series-video/$ ls-1v | grep .mkv > / tmp/1.m3u & & mv / tmp/1.m3u.

Let's take a look at what each part of this command means:

1.ls-1v = this is the use of ordinary ls to list the contents of the directory. Where-1 indicates that one file is displayed per line. And-v means to sort naturally according to the number (version) in the text.

2. | grep .mkv = basically tells ls to look for files that end with .mkv. It can also be .mp4 or any other media file format you want.

It is usually a good idea to run a trial run by running a command on the terminal:

Ls-1v | grep .mkvMy Web Series S01E01 [Episode 1 Name] Multi 480p WEBRip x264-xRG.mkvMy Web Series S01E02 [Episode 2 Name] Multi 480p WEBRip x264-xRG.mkvMy Web Series S01E03 [Episode 3 Name] Multi 480p WEBRip x264-xRG.mkvMy Web Series S01E04 [Episode 4 Name] Multi 480p WEBRip x264-xRG.mkvMy Web Series S01E05 [Episode 5 Name] Multi 480p WEBRip x264-xRG.mkvMy Web Series S01E06 [Episode 6 Name] Multi 480p WEBRip x264-xRG.mkvMy Web Series S01E07 [Episode 7 Name] Multi 480p Multi x264-Multi S01E08 [Episode 8 Name] Multi 480p WEBRip x264-xRG.mkv

It turned out that what I was going to do was right. Now the next step is to have the output output in the format of the .m3u playlist:

Ls-1v | grep .mkv > / tmp/web_playlist.m3u & & mv / tmp/web_playlist.m3u.

This creates the .m3u file in the current directory. The .m3u playlist is just a .txt file with the same content as above, with a .m3u extension. You can also edit it manually and add the exact file name in the order you want.

And then all you have to do is:

Mpv web_playlist.m3u

Generally speaking, the advantage of MPV and playlists is that you don't have to read them all at once. You can watch it for any long time at a time, and then check the rest next time.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

What is the method of creating M3U playlists in Linux terminals? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report