Index: test/test.c =================================================================== --- test/test.c (revision 2654) +++ test/test.c (working copy) @@ -68,6 +68,7 @@ static int default_acodec = HB_ACODEC_FAAC; static int default_abitrate = 160; static int audio_explicit = 0; +static int64_t audio_delay = 0; static char ** subtracks = NULL; static char ** subforce = NULL; static char * subburn = NULL; @@ -1794,6 +1795,11 @@ } } + if( audio_delay ) + { + job->audio_delay = audio_delay * 90; // Translate from ms to HB time. + } + if( srtfile ) { char * token; @@ -2270,6 +2276,8 @@ " Separated by commas for more than one audio track.\n" " -A, --aname Audio track name(s),\n" " Separated by commas for more than one audio track.\n" + " --adelay Set a positive number of ms to bring all the audio\n" + " tracks earlier, or a negative number of ms to add delay.\n" "\n" "### Picture Settings---------------------------------------------------------\n\n" @@ -2476,6 +2484,7 @@ #define SRT_CODESET 270 #define SRT_OFFSET 271 #define SRT_LANG 272 + #define AUDIO_DELAY 273 for( ;; ) { @@ -2555,6 +2564,7 @@ { "vfr", no_argument, &cfr, 0 }, { "cfr", no_argument, &cfr, 1 }, { "pfr", no_argument, &cfr, 2 }, + { "adelay", required_argument, NULL, AUDIO_DELAY }, { 0, 0, 0, 0 } }; @@ -2980,6 +2990,9 @@ else if( atoi( optarg ) == 709 ) color_matrix = 2; break; + case AUDIO_DELAY: + audio_delay = atoi( optarg ); + break; default: fprintf( stderr, "unknown option (%s)\n", argv[optind] ); return -1; Index: libhb/sync.c =================================================================== --- libhb/sync.c (revision 2654) +++ libhb/sync.c (working copy) @@ -139,6 +139,8 @@ pv->busy |= ( 1 << (i + 1) ); InitAudio( w, i ); } + + pv->audio_passthru_slip = job->audio_delay; } return 0; Index: libhb/common.h =================================================================== --- libhb/common.h (revision 2654) +++ libhb/common.h (working copy) @@ -234,6 +234,7 @@ /* List of audio settings. */ hb_list_t * list_audio; + int64_t audio_delay; /* Subtitles */