I am a happy user of minidlna (version 1.0.24) on an old Mac Mini G4. It does work quite well in my environment. Since minidlna does not allow transcoding, I would like to rip a set of DVDs (mostly cartoons) for viewing. However I failed to understand how to properly encode them for sole purpose of serving them over UPnP.

  • My DSL provider has a built-in client (Freebox ADSL, firmware 1.5.20), which simply refuse to serve ISO Media, MP4 Base Media v1 [IS0 14496-12:2003] (*.mp4) files.
  • I have a Windows 8 tablet, which does not support EBML file / Matroska (*.mkv) containers.

Therefore I need to use an AVI container for my setup. Now the complex part is what are the encoding options that I need to use to rip a DVD to an AVI container ?

Video: I've tested and both mpeg4 and x264 video stream works. As far as I understand x264 is not an option since I use AVI container. So what are the options for a good quality mpeg4 video stream ? Using trial and error I discovered that the video was a bit choppy using an mkv container with the following stream:

Stream #0.0(eng): Video: h264 (High), yuv420p, 1280x568 [PAR 1:1 DAR 160:71], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)

Audio: I've had issue with a file containing:

Stream #0.1(fre): Audio: dca (DTS), 48000 Hz, 5.1, s16, 1536 kb/s (default)

while any of these audio did work:

Stream #0.1(fre): Audio: aac, 48000 Hz, stereo, s16 (default)
Stream #0.1: Audio: mp3, 44100 Hz, mono, s16, 128 kb/s (default)

What audio option should I pick ?

bonus point: what is the complete avconv (ffmpeg) command line to convert directly from the dvd (*.vob) into such AVI ? I'd like to avoid using mencoder, since it has recently been removed from Debian.

EDIT: This is completely off-topic, but this may clarify the comments below. After multiples trials, I've diagnosed that the MPEG-4 container issue is really on the client side. I do not know why the client refuse to display it. I was able to take an *.mp4 container and transcode it using: mkvmerge -o out.mkv in.mp4, and now the file properly appear (and can be played!) on the client side. The same *.mp4 does appear nicely from the default Windows 8 Media Player, so this is definitely not a server issue.

EDIT2: The only trick used by minidlna for the FreeBox client can be seen here.

References: * Creating MP4 videos ready for HTTP streaming

  • To those voting to close, I fail to see what is subjective about this question. As for MP4, is it disabled by the server or is it just that the video will not play? Could be that you were just using the wrong encoding options..
    – slhck
    Feb 4, 2015 at 16:22

1 Answer 1


After some more research, I found out this previous post. So for generating *.mp4 file, the trick is to use:

$ ffmpeg -i input.avi -c:v libx264 -crf 22 -c:a libfaac -movflags faststart output.mp4

However -movflags faststart make sense only in the case of mp4 generation. Looking at man ffmpeg from a debian/jessie system, I was able to find the suggested DVD ripping one-liner:

$ ffmpeg -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi

The generated file play smoothly in my setup, I can fast-forward and rewind easily, so I guess the AVI is properly indexed (or at least is compatible with whatever is needed in the UPnP protocol).

Based on a few informations available on internet, it appears that Freebox V5 only support a limited set of format and codecs:

  • conteneur codec vidéo codec audio résolution maximale acceptée
  • ts (mpeg ts) mpeg4 ac52 1280×720
  • ts (mpeg ts) h264 ac52 1280×720
  • avi xvid mp3 1280×720 et 1440×1080

However there is partial support for matroska (*.mkv), in which case it was easier to install the mkv codecs from here. So in the end I used HandBrake (GUI) to convert DVD into mp4 (high profile + web optimized) and then transcode to mkv:

$ mkvmerge -q -o out.mkv --compression 0:none --compression 1:none in.mp4

Also one need to make sure to use the -map_chapters -1 avconv option to make sure there no chapter in the generated mkv output file. I have been unable to play any mkv file with chapters over UPnP (using minidlna), although they do play well locally (or over USB), with Windows Media Player (Windows 8.1).

$ ffmpeg -i input.mkv -map_chapters -1 -c:v copy -c:a copy output.mkv

Because I can make the FreeBox client crash easily (press fast forward button twice in a row to make the whole system reboot) using Full HD movies (1920x), I need to downscale the video a little (1280x):

$ ffmpeg -i in.mp4 -c:v libx264 -crf 23 -vf scale=1280:-1 -c:a aac -strict experimental -sn -movflags faststart -metadata title="aTitle" -metadata date="aYear" out.mp4 

Some movies were using ac3 and/or DTS which did not work for me, so having aac was an acceptable solution. Windows Media Player did not like ac3 over UPnP and FreeBox V5 (firmware 1.5.20) did not like DTS sound.

So when the input is an AVI container with an ac3 sound stream you'll need to convert it to mp4 (actually mkv for the FreeBox):

$ ffmpeg -i input_with_ac3.avi -c:v copy -c:a copy output.mp4

If you want mkv and do not want to convert first to mp4 and then mkv, you'll need a work around for the error:

[matroska @ 0x1b62100] Can't write packet with unknown timestamp av_interleaved_write_frame(): Invalid argument

See for example here:

$ ffmpeg -fflags +genpts -i input_with_ac3.avi -c copy out.mkv

Update: sometimes using mpeg4_unpack_bframes does lead to a smaller file size. See doc.

Update: Pay attention that if you work on Linux, ntfs-3g default to using windows_names:off, so you should not create new files with ':' in it (windows media player and VLC do not support them). See here.

Update: FreeBox will require specific pixel format: -pix_fmt yuv420p. It is also possible to use -profile:v high -level 4.0 since the *.ts file produce by the box are using this profile (ffprobe -show_streams *.ts | grep "profile\|level")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.