Windows – Creating PSP Thumbnails Using VLC and the Command Line

Windows 8 Logo

In my previous post I detailed the Handbrake settings that I am using to convert YouTube (and other) videos to play on my Play Station Portable (PSP).

Creating thumbnails for these PSP videos is a “nice to have” – but it is time consuming if it is not automated.

PSP thumbnails are simple to understand – they are jpeg files (160 x 120 pixels) that have had their extension changed to .thm. Videos and thumbnails must share the same filename on the PSP. So for a video called my_video.mp4 we would create a thumbnail called my_video.thm.

After looking at a lot of blogs and the VLC documentation I came up with a command line script that created a single jpeg thumbnail for each mp4 file in the current working directory:

for %i in (*.mp4) do if NOT exist "%~ni_*.jpg" start /WAIT "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --rate=2.0 --video-filter=scene --start-time=280 --stop-time=281 --scene-format=jpg --scene-replace --scene-ratio=18 --scene-width=160 --scene-height=120 --scene-path="%CD%" --scene-prefix="%~ni" "%CD%\%i" vlc://quit

The above command line is modified from this post. It can be broken down as follows:

  • for %i in (*.mp4): filters the media to process (in my case .mp4 files)
  • do if NOT exist “%~ni_*.jpg”: creates a jpeg snapshot (if it does not already exist)
  • start /WAIT “”: is required to only process one video at a time
  • “C:\Program Files (x86)\VideoLAN\VLC\vlc.exe”: This is the path to vlc.exe on Windows 8 x64.
  • –rate=2.0: sets the playback speed. I set this to 2.0 so that vlc plays the specified video segments at twice the normal speed.
  • –video-filter=scene: the scene video filter sends video to picture files
  • –start-time=280: the stream will start at this position (in seconds)
  • –stop-time=281: the stream will stop at this position (in seconds)
  • –scene-format=jpg: specifies the screenshot format
  • –scene-replace: always writes to the same output file. This is used so that I can obtain a single screenshot that only needs the extension to be renamed.
  • –scene-ratio=18: the ratio of images to record. Initially this was set to 24 (1 image every 24 frames) – however with a start and stop time interval of one second I found that some of the screenshots that vlc output were black screens. I lowered this value until I could consistently generate screenshots from multiple .mp4 files. Your mileage may vary.
  • –scene-width=160: output image width
  • –scene-height=120: output image height
  • –scene-path=”%CD%”: output image directory – %CD% specifies current working directory
  • –scene-prefix=”%~ni” “%CD%\%i”: output image name – in this case the same name as the .mp4 video and the same working directory
  • vlc://quit: Quit vlc

The above script works when it is pasted into a command prompt window – but it required me to navigate to the drive and directory that contained my videos – and I still needed to change the extension of the screenshots produced to .thm. So the next step was to modify the script so that it would run in a batch file.

cd PSP

for %%i in (*.mp4) do if NOT exist "%%~ni_*.jpg" start /WAIT "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --rate=2.0 --video-filter=scene --start-time=280 --stop-time=281 --scene-format=jpg --scene-replace --scene-ratio=18 --scene-width=160 --scene-height=120 --scene-path="D:\PSP" --scene-prefix="%%~ni" "D:\PSP\%%i" vlc://quit

ren *.jpg *.thm

The differences made between the first and second scripts are as follows:

  • d: changes drive from c: to d:
  • cd PSP: changes directory to PSP
  • single percentage signs % are all changed to double percentage signs %% to allow the script to run in a batch file
  • –scene-path=”D:\PSP: the output image directory is changes to D:\PSP
  • –scene-prefix=”%%~ni” “D:\PSP\%%i”: the output image name also specifies the D:\PSP directory
  • ren *.jpg *.thm: renames all jpeg files in D:\PSP to .thm files

Many thanks to ComCBoVudLaBa on the VLC forum for providing a script with supporting comments that does all of the heavy lifting required. After some experimentation and tweaking I ended up with a batch file that completely automated the creation of PSP thumbnails from .mp4 videos!


Windows – Convert YouTube Videos for the PSP using Handbrake

Windows 8 Logo

I recently dusted off my old Play Station Portable (PSP) because I wanted to watch some YouTube videos on it.

On my PC I used the Download Flash and Video Firefox extension to download 360p .mp4 videos from YouTube but when I opened Handbrake to convert my videos I found that there is was longer a PSP profile available.

The Handbrake settings that I used are as follows:

First select the Universal profile and then make these changes under Output Settings:

  • set Anamorphic to None
  • set the Width to 480
  • check the Keep Aspect Ratio check-box.


Note: Even though the Container is set to Mp4 the Destination File extension is set to .m4v. Change the Destination File extension to .mp4.

Click on the Video tab and then click the Avg Bitrate (kbps) radio button.

  • set the Avg Bitrate to 768.


If you end up with a .m4v video when the conversion is complete you can simply change the extension to .mp4 before transferring it to your PSP.


Ubuntu 10.4 Lucid – Kdenlive ‘Not Connected’ Error In Record Monitor

Keen to try editing HD video from my Canon HV30 on Ubuntu I installed Kdenlive.

sudo apt-get update
sudo apt-get install kdenlive

That was the easy bit, as when I hooked up my camcorder and clicked on the Kdenlive record monitor I got a ‘not connected’ message.

So I followed the advice on the Kdenlive site for troubleshooting Firewire capture:

lsmod | egrep 'firewire|1394'

The output of this command showed that I had the old Firewire stack compiled in my kernel. And so the troubleshooting began – the first step being to make sure that the correct modules were loaded at boot by editing the /etc/modules file:

sudo gedit /etc/modules

Simply add the following lines to modules and then save the file:


Alas the problem still was not fixed. So I took a look at /dev/raw1394 and saw that only the root and video users had permissions to this resource. So I added myself to the video users group:

sudo adduser  <username> video

I rebooted for good measure and found that I had made progress – but now the record monitor just said ‘initializing’ but did not progress any further.

Thankfully this was easily solved by configuring Kdenlive properly for my camcorder. I simply had to tell Kdenlive that my capture format was High Definition Video (HDV).

Bring up the configuration window by clicking the spanner icon in the record monitor box. Click the Capture icon in the left panel and then select HDV as the capture format in the drop-down menu.

Click OK to continue and then restart Kdenlive!

As you can see I can now control and see footage on my HD Camcorder with Kdenlive – now to start editing some video (at last)!