From 07a027ef87333662b3709215025838646ee3d6be Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 15 Oct 2006 00:57:16 +0000 Subject: [PATCH] Added more standard headers that are strictly required. Added explicit input frame rate to ffmpeg command line since the assumed default is 25 fps and *not* the output frame rate. Changed menu duration to 12 frames regardless of frame rate since this *should* be legal at 29.97 fps and it seems to avoid some problematic rounding errors. --- generate_dvd.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/generate_dvd.cpp b/generate_dvd.cpp index 398fdd1..64079d2 100644 --- a/generate_dvd.cpp +++ b/generate_dvd.cpp @@ -1,8 +1,12 @@ // Copyright 2005-6 Ben Hutchings . // See the file "COPYING" for licence details. +#include +#include #include +#include #include +#include #include #include @@ -76,11 +80,16 @@ namespace // We would like to use just a single frame for the menu but this // seems not to be legal or compatible. The minimum length of a // cell is 0.4 seconds but I've seen a static menu using 12 frames - // on a "PAL" disc so let's say 0.5 seconds rounded down. - const char menu_duration_string[] = "0.5"; + // on a commercial "PAL" disc so let's use 12 frames regardless. unsigned menu_duration_frames(const video::frame_params & params) { - return params.rate_numer / params.rate_denom / 2; + return 12; + } + double menu_duration_seconds(const video::frame_params & params) + { + return double(menu_duration_frames(params)) + * double(params.rate_numer) + / double(params.rate_denom); } } @@ -212,7 +221,10 @@ void dvd_generator::generate_menu_vob(unsigned index, std::string("symlink: ").append(std::strerror(errno))); } command_stream << - "ffmpeg -f image2 -vcodec png -i " << background_name << "-%02d" + "ffmpeg -f image2 -vcodec png" + " -r " << frame_params_.rate_numer << + "/" << frame_params_.rate_denom << + " -i " << background_name << "-%02d" " -target " << frame_params_.common_name << "-dvd" " -vcodec mpeg2video -aspect 4:3 -an -y /dev/stdout"; } @@ -373,7 +385,9 @@ void dvd_generator::generate(const std::string & output_dir) const // Define a cell covering the whole menu and set a still // time at the end of that, since it seems all players // support that but some ignore a still time set on a PGC. - " \n" " \n"; -- 2.39.5