Open Video Workbook

Hands-On: Transcoding with FFmpeg

Create an MPPEG2 file for a DVD

In this part, you will find out how to encode in MPEG2, the format for the dvd authoring.

The DVD use the compression MPEG 2. The size or the resolution of the picture is 720x576 in a frame rate of 25 frames per second for Europe and for USA it is 720x480 in a frame rate of 29.97 frames per second. The aspect can be in 4/3 or 16/9. The total bitrate is at maximum 9800 kb/s. Generally, the video bitrate is 8000 kb/s and the audio 1536 kb/s. The rate of compression depends of the duration of your video. You have to adapt the quality of your compression with the size of the memory of your optical support in this case the DVD.

Stay with your Terminal or Konsole, we'll use FFMPEG for this in the first case. Why? Because FFMPEG has a preset for that and becuase FFMPEG is published under a GLP licence. The method is very simple. Call FFMPEG, choose your video to encode, call the preset to encode for a DVD and name your new file media in MPEG2 format that will be generated.

ffmpeg -i your_video.mp4 -target pal-dvd your_dvd.mp2

And validate by Enter on your keyboard. The processus of encodage is starting. It will take a certain time.

Some basics commands can refine your project, change the letter x by your own value ;

  • -b xxxk to define the bitrate of your video codec
  • -ab xxxk to define the bitrate of you audio codec
  • -aspect x:x  to define 16/9 or 4/3

Create an DV Avi file for Video Editors

To create a DV avi type 2 that is understood by video editing applications like Premiere and Windows movie maker we can use the first transcode to create a normal .dv file.

ffmpeg -i yourfile.MOV -target pal-dv  -aspect 16:9 -y newfile.dv

You can then follow this up to make it conpatible as a 'microsoft dv avi' by adding a fourcc tag "dvsd" which identifies it as a 'microsoft' dv file and changing the file extension.

 newfile.dv -vcodec copy -vtag dvsd -acodec copy -aspect 16:9 -y newdvfile.avi

There may be a way of doing all of this in one line, but I don't know how to do this yet.

Batch Encoding

If you want to do this for more than one file in a directory then you can create a short command line script to do this. Try it out to see how it works.

for file in *.MOV;do ffmpeg -i "$file" -target pal-dv  -aspect 16:9 -y "$file.dv";done

for file in *.dv;do ffmpeg -i "$file" -vcodec copy -vtag dvsd -acodec copy -aspect 16:9 -y "$file.avi";done