diff options
author | jbrjake <[email protected]> | 2007-11-21 17:41:33 +0000 |
---|---|---|
committer | jbrjake <[email protected]> | 2007-11-21 17:41:33 +0000 |
commit | 69292c177437f339a59a55954207bc400304e046 (patch) | |
tree | b379eaf8ebfd58cd76d8dc7e9dbb68030d032235 /libhb | |
parent | ab407726d79cfcda9a6c32b54e18f5f643965d19 (diff) |
Optimize MP4 files for HTTP streaming (on the CLI it's -O or --optimize).
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://svn.handbrake.fr/HandBrake/trunk@1074 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.h | 2 | ||||
-rw-r--r-- | libhb/muxmp4.c | 24 |
2 files changed, 13 insertions, 13 deletions
diff --git a/libhb/common.h b/libhb/common.h index 8a45d7eb7..1f16366e8 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -259,7 +259,7 @@ struct hb_job_s /* Allow MP4 files > 4 gigs */ int largeFileSize; - + int mp4_optimize; int indepth_scan; hb_subtitle_t ** select_subtitle; diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index d279667ee..0760aac64 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -323,6 +323,9 @@ static int MP4Init( hb_mux_object_t * m ) /* 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 */ @@ -464,11 +467,6 @@ static int MP4End( hb_mux_object_t * m ) 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. */ { @@ -499,13 +497,15 @@ static int MP4End( hb_mux_object_t * m ) 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; } |