Monday, April 03, 2017

Creating Video Files for a Sylvania Portable DVD Player

I had the great idea, instead of lugging around DVDs for my Sylvania Portable DVD Player (SDVD7040B), to make use of the USB port and just use video files instead.
However this device didn't like MP4 or some other video formats I threw at it.
I finally figured out it wants XviD encoded video in an AVI container with MP3 audio at a constant bitrate. Using ffmpeg I used the following options:


-r 29.97 -vcodec libxvid -q:v 5 -aspect 4:3 -acodec libmp3lame -ab 128k -ac 2

(use XviD codec for video, set output framerate to 29.97fps, use quality setting 5,  use the aspect ratio 5:4, use MP3 codec for audio, use 128kbps constant bit-rate for audio, and the audio is 2 channels (stereo))
The q:v option isn't required but -q:v 5 sets it at a decent quality at least for playback on this device. (Worked out to a little under 9.5MB/min for me.) Setting the frame rate to 29.97fps results in a smaller file.
The aspect ratio of 4:3 is important because if you encode in 16:9 (which most shows and movies are in nowdays) then the player will letterbox your video. Even starting with 16:9 video, the resulting 4:3 aspect won't look squished because the physical screen on the device is spread out to compensate. (If you need to play the file on a computer, you can force playback in 16:9 in VLC, for example.)
The source file was created by Handbrake so it was already a DVD friendly 720x480. When I was testing various other formats on this device sometimes I got a resolution not supported error. Again there is nothing saying what resolutions are supported, but as far as I can tell this device does not like anything over 720 (horizontal). If you are using this settings to convert widescreen video sources over 720 width, add this parameter:
-vf "scale=720:-2"

I am also hoping that this has the advantage of extending battery life since it doesn't have to spin a DVD.

If you have 4:3 aspect video (full screen not widescreen) then the Sylvania Portable DVD Player is a little wonky. Even directly playing a full screen DVD the device stretches the image out instead of pillarboxing and shrinking the image horizontally to maintain the aspect ratio. So using the same settings I used for a 16:9 widescreen film resulted in the video being stretched to fill the screen.
To compensate for this, you need your source video to be 640x480 (if you are using Handbrake, set Anamorphic to none.) Then use the following ffmpeg settings to manually pillarbox the video when you convert to XviD:

-r 29.97 -vcodec libxvid -q:v 5 -aspect 4:3 -vf "scale=560:480, pad=720:480:80:0" -acodec libmp3lame -ab 128k

The reason you have to further scale down to 560x480 because of the wonky screen on the device. (Took some trial and error to figure out 560 was best.) You still have to specify an aspect of 4:3 or the device will letterbox your video as well because ffmpeg will output an aspect of 3:2.

No comments: