Has mpeg4ip run a second pass after muxing is complete, to move the MOOV atom to the beginning of the file. To get this to work, I had to replace a patch from Perian, which has written the avc1 "Compressor Name" in the Pascal string style QuickTime expects. Unfortunately, that patch left mpeg4ip unable to parse its own output, when muxing x264 video. Instead, now the Compressor Name is a blank string, and QuickTime substitutes "H.264" for it.
NOTE: This is *not* hinting for RTP streaming, just shuffling the container around so it starts playing faster over the web.
git-svn-id: svn://localhost/HandBrake/trunk@1074
b64f7644-9d1e-0410-96f1-
a4d463321fa5
cd `dirname $(>)` && CONTRIB=`pwd` &&
rm -rf mpeg4ip && (gzip -dc mpeg4ip.tar.gz | tar xf - ) &&
cd mpeg4ip &&
- $(PATCH) -p1 < ../patch-mpeg4ip.patch && $(PATCH) -p0 < ../patch-mpeg4ip-pascal-str.patch &&
+ $(PATCH) -p1 < ../patch-mpeg4ip.patch && $(PATCH) -p0 < ../patch-mpeg4ip-no_compressor_name.patch &&
./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
$(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
cd `dirname $(>)` && CONTRIB=`pwd` &&
rm -rf mpeg4ip && (gzip -dc mpeg4ip.tar.gz | tar xf - ) &&
cd mpeg4ip &&
- $(PATCH) -p1 < ../patch-mpeg4ip.patch && $(PATCH) -p1 < ../patch_mpeg4ip_cygwin.patch && $(PATCH) -p0 < ../patch-mpeg4ip-pascal-str.patch &&
+ $(PATCH) -p1 < ../patch-mpeg4ip.patch && $(PATCH) -p0 < ../patch-mpeg4ip-no_compressor_name.patch && $(PATCH) -p1 < ../patch_mpeg4ip_cygwin.patch &&
./bootstrap --cache-file=$CONTRIB/config.cache --disable-mp3lame --disable-faac --disable-x264 --disable-server --disable-player &&
$(MAKE) -C lib/mp4v2 libmp4v2.la && cp lib/mp4v2/.libs/libmp4v2.a $CONTRIB/lib &&
cp mpeg4ip_config.h include/mpeg4ip.h include/mpeg4ip_version.h \
--- /dev/null
+--- lib/mp4v2/atom_avc1.cpp.bak.cpp 2004-07-13 17:07:50.000000000 -0400
++++ lib/mp4v2/atom_avc1.cpp 2007-11-19 13:44:21.000000000 -0500
+@@ -41,7 +41,7 @@
+ MP4StringProperty* pProp =
+ new MP4StringProperty("compressorName");
+ pProp->SetFixedLength(32);
+- pProp->SetValue("AVC Coding");
++ pProp->SetValue("");
+ AddProperty(pProp); /* 6 */
+
+ AddReserved("reserved4", 4); /* 7 */
/* Allow MP4 files > 4 gigs */
int largeFileSize;
-
+ int mp4_optimize;
int indepth_scan;
hb_subtitle_t ** select_subtitle;
/* Set the correct number of channels for this track */
reserved2[9] = (u_int8_t)HB_AMIXDOWN_GET_DISCRETE_CHANNEL_COUNT(audio->amixdown);
MP4SetTrackBytesProperty(m->file, mux_data->track, "mdia.minf.stbl.stsd.mp4a.reserved2", reserved2, sizeof(reserved2));
+
+ /* If we ever upgrade mpeg4ip, the line above should be replaced with the line below.*/
+// MP4SetTrackIntegerProperty(m->file, mux_data->track, "mdia.minf.stbl.stsd.mp4a.channels", (u_int16_t)HB_AMIXDOWN_GET_DISCRETE_CHANNEL_COUNT(audio->amixdown));
/* store a reference to the first audio track,
so we can use it to feed the chapter text track's sample rate */
free(sample);
}
-#if 0
- hb_job_t * job = m->job;
- char filename[1024]; memset( filename, 0, 1024 );
-#endif
-
if (job->areBframes)
/* Walk the entire video sample table and find the minumum ctts value. */
{
MP4Close( m->file );
-#if 0
- hb_log( "muxmp4: optimizing file" );
- snprintf( filename, 1024, "%s.tmp", job->file );
- MP4Optimize( job->file, filename, MP4_DETAILS_ERROR );
- remove( job->file );
- rename( filename, job->file );
-#endif
+ if ( job->mp4_optimize )
+ {
+ hb_log( "muxmp4: optimizing file" );
+ char filename[1024]; memset( filename, 0, 1024 );
+ snprintf( filename, 1024, "%s.tmp", job->file );
+ MP4Optimize( job->file, filename, MP4_DETAILS_ERROR );
+ remove( job->file );
+ rename( filename, job->file );
+ }
return 0;
}
static int preset = 0;
static char * preset_name = 0;
static int vfr = 0;
+static int mp4_optimize = 0;
/* Exit cleanly on Ctrl-C */
static volatile int die = 0;
{
job->largeFileSize = 1;
}
+ if ( mp4_optimize )
+ {
+ job->mp4_optimize = 1;
+ }
job->file = strdup( output );
" autodetected from file name)\n"
" -4, --large-file Use 64-bit mp4 files that can hold more than\n"
" 4 GB. Note: Breaks iPod, @TV, PS3 compatibility.\n"""
+ " -O, --optimize Optimize mp4 files for HTTP streaming\n"
"\n"
"### Picture Settings---------------------------------------------------------\n\n"
{ "input", required_argument, NULL, 'i' },
{ "output", required_argument, NULL, 'o' },
{ "large-file", no_argument, NULL, '4' },
+ { "optimize", no_argument, NULL, 'O' },
{ "title", required_argument, NULL, 't' },
{ "longest", no_argument, NULL, 'L' },
int c;
c = getopt_long( argc, argv,
- "hvuC:f:4i:o:t:Lc:ma:6:s:UFN:e:E:2d789gpP::w:l:n:b:q:S:B:r:R:Qx:TY:X:VZ:z",
+ "hvuC:f:4i:o:t:Lc:ma:6:s:UFN:e:E:2d789gpOP::w:l:n:b:q:S:B:r:R:Qx:TY:X:VZ:z",
long_options, &option_index );
if( c < 0 )
{
case '4':
largeFileSize = 1;
break;
+ case 'O':
+ mp4_optimize = 1;
+ break;
+
case 't':
titleindex = atoi( optarg );
break;