[FFmpeg-user] ffmpeg + dvdauthor incorrect aspect ratio conversion

Dave Lakers emailboxaccounts at gmail.com
Wed Feb 8 20:45:50 CET 2012


Hi all

I am trying to create a DVD using DVDAuthor and without any DVDAuthor GUIs
because I am automating the  DVD production process without GUI
intervention. Everything seems to be going well and we are nearly done apart
from the screen resolution of the DVD when its played on a DVD player. The
sides and top are cutoff from the DVD image. 

If anyone can help it would be appreciated, we’re trying to distribute
thousands of free educational dvds to kids in poor countries. Heres the full
story....

I have two files which are in MP4 (640x360 in 16:9 and 1280x720) format
which I first convert to MPEG using ffmpeg.

ffmpeg -i video1. mp4 -target pal-dvd -ar 48000 -y video1.mpeg

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2011-07-16 13:33:56
  Duration: 00:17:38.64, start: 0.000000, bitrate: 125 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 58 kb/s, 14.99 fps, 14.99
tbr, 59956 tbn, 29.98 tbc
    Metadata:
      creation_time   : 2011-07-16 13:33:56
      handler_name    :
/tmp/zenengine/c9e/b26/file_flvc9eb26c091dd012e53ea12313b06c051/video.264 -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16,
64 kb/s
    Metadata:
      creation_time   : 2011-07-16 13:33:56
      handler_name    :
/tmp/zenengine/c9e/b26/file_flvc9eb26c091dd012e53ea12313b06c051/audio.aac -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
[buffer @ 0x2216740] w:640 h:360 pixfmt:yuv420p tb:1/1000000 sar:1/1
sws_param:
[scale @ 0x2217920] w:640 h:360 fmt:yuv420p -> w:720 h:576 fmt:yuv420p
flags:0x4
Incompatible sample format 's16' for codec 'ac3', auto-selecting format
'flt'
Output #0, dvd, to 'video1.mpeg':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2011-07-16 13:33:56
    encoder         : Lavf53.24.2
    Stream #0:0(und): Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR
16:9], q=2-31, 6000 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2011-07-16 13:33:56
      handler_name    :
/tmp/zenengine/c9e/b26/file_flvc9eb26c091dd012e53ea12313b06c051/video.264 -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
    Stream #0:1(und): Audio: ac3, 48000 Hz, stereo, flt, 448 kb/s
    Metadata:
      creation_time   : 2011-07-16 13:33:56
      handler_name    :
/tmp/zenengine/c9e/b26/file_flvc9eb26c091dd012e53ea12313b06c051/audio.aac -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg2video)
  Stream #0:1 -> #0:1 (aac -> ac3)


and the second video (1280x720 in 16:9 ) video2.mp41280 h:720 

ffmpeg version 0.9.1, Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 14 2012 14:48:02 with gcc 4.6.1
  configuration: 
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 42. 4 / 53. 42. 4
  libavformat  53. 24. 2 / 53. 24. 2
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2011-07-16 13:32:46
  Duration: 00:01:03.81, start: 0.000000, bitrate: 403 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 335 kb/s, 15.15 fps,
15.15 tbr, 7576 tbn, 30.30 tbc
    Metadata:
      creation_time   : 2011-07-16 13:32:46
      handler_name    :
/tmp/zenengine/ca2/f92/file_mp4ca2f928091dd012e076e12313b079606/video.264 -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16,
65 kb/s
    Metadata:
      creation_time   : 2011-07-16 13:32:46
      handler_name    :
/tmp/zenengine/ca2/f92/file_mp4ca2f928091dd012e076e12313b079606/audio.aac -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
[buffer @ 0x262eb40] w:1280 h:720 pixfmt:yuv420p tb:1/1000000 sar:1/1
sws_param:
[scale @ 0x2624860] w:1280 h:720 fmt:yuv420p -> w:720 h:576 fmt:yuv420p
flags:0x4
Incompatible sample format 's16' for codec 'ac3', auto-selecting format
'flt'
Output #0, dvd, to'video2.mpeg’:
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2011-07-16 13:32:46
    encoder         : Lavf53.24.2
    Stream #0:0(und): Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR
16:9], q=2-31, 6000 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2011-07-16 13:32:46
      handler_name    :
/tmp/zenengine/ca2/f92/file_mp4ca2f928091dd012e076e12313b079606/video.264 -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
    Stream #0:1(und): Audio: ac3, 48000 Hz, stereo, flt, 448 kb/s
    Metadata:
      creation_time   : 2011-07-16 13:32:46
      handler_name    :
/tmp/zenengine/ca2/f92/file_mp4ca2f928091dd012e076e12313b079606/audio.aac -
Imported with GPAC 0.4.6-DEV (internal rev. 8)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg2video)
  Stream #0:1 -> #0:1 (aac -> ac3)


So both files are converted to DVD PAL format of 720x576 in DAR 16:9. 

Now I have a main menu (mainmenu.mpeg) and title menu (background.mpeg) with
20x576 in DAR 16:9. using ffprobe

Input #0, mpeg, from 'background.mpeg':
  Duration: 00:02:17.76, start: 0.120000, bitrate: 132 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR
16:15 DAR 4:3], 7500 kb/s, 1 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x20]: Subtitle: dvd_subtitle
    Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s

Input #0, mpeg, from 'mainmenu.mpeg':
  Duration: 00:04:22.60, start: 0.120000, bitrate: 130 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR
16:15 DAR 4:3], 7500 kb/s, 1 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x20]: Subtitle: dvd_subtitle
    Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s

I put all this together using DVDAuthor


<dvdauthor>
	<vmgm>
	<fpc>jump menu 1; </fpc>
		<menus>
			<video format="PAL" aspect="4:3" resolution="720x576"/>
			<pgc entry="title">
				<vob file="mainmenu.mpeg" pause="inf" />
				<button>jump titleset 1 menu;</button>

			</pgc>
		</menus>
	</vmgm>
	<titleset>
	<menus>
		<pgc>
			<vob file="background.mpeg" pause="inf" />
			<button>jump title 1 chapter 1;</button><button>jump title 1 chapter
2;</button><button>jump vmgm menu entry title; </button>
		</pgc>
	</menus>
	<titles>
		<pgc >
		<vob file="video1.mpeg" pause="3" />
<vob file="video2.mpeg" pause="3" />
	
		<post> call menu; </post>
		</pgc>
	</titles>
</titleset>
</dvdauthor>

main menu output

INFO: Generating VMGM with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch,  48khz 20bps


video 2 output

INFO: Video pts = 0.540 .. 64.340
INFO: Audio[0] pts = 0.540 .. 64.380
STAT: VOBU 1871 at 212MB, 1 PGCs
CHAPTERS: VTS[1/1] 0.000
CHAPTERS: VTS[1/2] 0.000
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 16:9
INFO: Resolution: 720x576
INFO: Audio ch 0 format: ac3/2ch,  48khz drc


background output

STAT: VOBU 1 at 2MB, 1 PGCs
CHAPTERS: VTS[1/1] 0.000
INFO: Generating VTSM with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch,  48khz 20bps

All the navigation and menus work fine BUT in a (non PC/laptop)  DVD player,
the image looks slightly stretched and the edges and the top image overhangs
the screen by quite a bit. In other words the image does not fit the screen
and the edges and the top are cut off.

OK so I know that I am going from 16:9 in video1 and video2 to 4:3 and that
video1 and video2 originally had different aspect ratios. However all final
output files are 720x576 and 4:3.

Is this just overburn or a problem with DVDauthor or ffmpeg?  
Is there a more appropriate scaling (filter) I should use for ffmpeg instead
of -target pal-dvd? (Can anyone give me an example)
Should everything be 16:9? (not ideal as most of our users don;t have
widescreen)
How can I mix 16:9 with 4:3 videos in this way? some posts suggest each
class in its different title-sets which they already are menus are 4:3
others are 16:9.
Is there something wrong with the DVDAuthor XML?
Is there some widescreen e.g. nopalscan setting which may help?

Anyone please help? We’re so close, this is the final issue to resolve.
Thanks so much



--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/ffmpeg-dvdauthor-incorrect-aspect-ratio-conversion-tp4370633p4370633.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list