Social media

Saturday, August 8, 2015

How to create a playlist on VLC for Android devices

This information seems to be outdated by now since newer VideoLan (VLC) for Android versions have a working playlist function. This site explains it nicely. But I leave the old info here because the same method can be applied when editing a text file on the Android file system otherwise.

Searching the web for this topic today (August 2015) raises more questions than answers. Even the official Videolan documentation does not have an answer (August 2015 that is). Because when ever you created a playlist, the first time you play a different media file out of this list it scratches your playlist. More by accident I discovered a way to create a playlist which isn't lost. Unfortunately the procedure I describe needs you to log in to the Linux itself, running on every Android device, thus many people who have no knowledge about Linux (or have not Linux installed on the desktop or laptop computer) might not succeed.

As mentioned you need to have access to the Linux running on Android. You need to create a file there which contains a list of the files you want to have in the playlist on your device - one line for any song or video you want in this playlist.

Procedure

You can either install ADB (Android Debug Bridge command line tool) (here an example for Debian, but other Linux distributions should have it too - use your package manager to find and install it) or the SDK suit which is also available for other platforms like Windows or Mac. You also need to connect your Android device with your computer via USB cable and activate USB debugging mode. This example is for Nexus, but shall work on any Android.

Further assuming you put this playlist file into the same directory where you have all media files you want in this playlist to ease this procedure, you need to create this playlist inside this directory.

Creation of the playlist from outside of Android

If you have an identical directory on your computer, because by chance you once copied the whole content from your computer to the Android device, and all files are media files without exception, you execute (for Linux)

cd where/your/directory/is

ls -1 >> playlist.mp3


Using Windows you might type

dir * >> playlist.mp3

instead.

Note that the playlist file has an extension *.mp3 which is technically incorrect because playlist files usually have something like *.m3u or *.pls and other. But as I mentioned I found this out by giving *.mp3 extension by accident.

Verify that the just created playlist file has one line your each media file.

Getting the playlist file to your Android device

On your computer execute

adb push playlist.mp3 /sdcard/where/your/media/files/are/playlist.mp3

where /sdcard/where/your/media/files/are is where your files are actually located on your Android. You're done. Start VLC on your Android, select Directories and find playlist.mp3. Select it and VLC should now play all the files.

Creation of the playlist from inside of Android (using Linux)

Log in to the Linux running on your Android device by executing

adb shell

Change the so called working directory to where your media files are located.

cd /sdcard/where/your/media/files/are

Execute

ls -1 > playlist.mp3

I am not sure if the "-1" works on all Android Linuxes. If it fails try without "-1" and hope it just creates this file with one line for every song without any other information. Verify this.

You're done. Start VLC on your Android, select Directories and find playlist.mp3. Select it and VLC should now play all the files.

I hope that works for you. Enjoy! Please post here if you found any errors or have comments.

6 comments:

  1. It created the .mp3 playlist, but nothing happens when i click on it. Have the instructions changed? Will m3u work now?

    ReplyDelete
    Replies
    1. Still working here. But there were no updates for the app itself here for a long time.

      I also made a typo at

      ls -1 > > playlist.mp3

      which must be

      ls -1 >> playlist.mp3

      for Linux. Also had the same mistake with the Windows procedure. Both corrected here now.

      Delete
    2. Got a new (Marshmallow) device and put m3u as file extension. It kind of works. But every time I start VLC it forgot that I used the playlist last time. Plus although I selected shuffle it always starts with the first entry and I have to activate it again. Until the next start.

      Funny that works on the PC version without a hassle. I wonder if VLC neglects the development of the Android version a little.

      Delete
  2. ls -1 does indeed not work on all versions of linux.
    If my music directory contains subdirectories, how might I construct a list with those included (in fact, they are all in subdirectories)?

    ReplyDelete
  3. Playlists are not created correctly from UPNP shares in 3.0.13 and going back some versions. Instead of the real track name the internal UPNP hash (i.e. 764.flac) is stored in the playlist thus rendering the playlist useless.

    ReplyDelete
    Replies
    1. Good point. But I created the playlist with a text editor on the PC, bypassing everything an VLC on Android.

      UPNP shares are a completely different matter. No need to create a playlist here as the files are read from the UPNP server already and thus are part of the "playlist".

      Delete