// Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
// See the file "COPYING" for licence details.
+#include <cerrno>
+#include <cstring>
#include <fstream>
+#include <iomanip>
#include <iostream>
+#include <ostream>
#include <sstream>
#include <stdexcept>
// 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);
}
}
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";
}
// 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.
- " <cell start='0' end='" << menu_duration_string << "'"
+ " <cell start='0' end='"
+ << std::fixed << std::setprecision(4)
+ << menu_duration_seconds(frame_params_) << "'"
" chapter='yes' pause='inf'/>\n"
" </vob>\n";