Page MenuHomePhabricator

ogg transcodes too slow on specific file
Closed, DeclinedPublic

Event Timeline

Bawolff updated the task description. (Show Details)
Bawolff raised the priority of this task from to Needs Triage.
Bawolff added a project: TimedMediaHandler.
Bawolff added a subscriber: Bawolff.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 10 2015, 7:42 PM
Reedy set Security to None.Oct 10 2015, 7:52 PM
Reedy added subscribers: brion, Joe.
brion added a comment.Oct 10 2015, 9:58 PM

For testing reference, from one of the err messages the command line is:

'/usr/bin/ffmpeg2theora' '/tmp/localcopy_b74bf89aa6af-1.ogv' -V '2048' -a '2' -H '44100' -c '2' --no-upscaling --two-pass --optimize --keyint '128' --buf-delay '256' --width '854' --height '480' --aspect '854:480' -o '/tmp/transcode_480p.ogv3f2d1edbbcae-1.ogv'

I'll take a peek and see if I can repro isolated.

brion claimed this task.Oct 10 2015, 10:07 PM

Ok, can confirm -- looks like something's getting stuck in a loop partway through the encoding - it gets stuck on the second pass around 31 seconds into the file. Time to break out the debugger \o/

Ok, with --buf-delay cranked up to something like 3072 I get a fail-out with "Error submitting pass data in second pass." There seems to be a bug in theora's oc_enc_select_qi function where it gets stuck in a loop instead of dying out... and presumably there's another bug either in theora or ffmpeg2theora that's producing bogus input data?

/*If we find a keyframe, remove it and everything past it.*/
if(m->frame_type==OC_INTRA_FRAME){
  do{
    qti=m->frame_type;
    nframes[qti]--;
    scale_sum[qti]-=oc_bexp_q24(m->log_scale);
    buf_delay-=m->dup_count+1;
    fmi++;
    if(fmi>=_enc->rc.cframe_metrics)fmi=0;
    m=_enc->rc.frame_metrics+fmi;
  }
  while(fmi!=fm_tail);
  /*And stop scanning backwards.*/
  break;
}

In the infinite-loop case fm_tail is 2252 and _enc->rc.cframe_metrics is 256 (the buf_delay value). So when fmi gets reset to 0, it never makes it up to 2252 because it's always reset to 0 after reaching 256, and we never leave the loop.

brion added a comment.Oct 11 2015, 5:25 AM

Patch in SVN upstream, but the SVN is semi-deprecated in favor of the git repo and we have to figure out how to migrate the patch. :D Will poke at it tomorrow or Monday then update the package from the updated git repo.

TheDJ moved this task from Backlog to Transcoding on the TimedMediaHandler board.Oct 21 2015, 6:59 PM
brion closed this task as Declined.Sep 13 2017, 5:12 PM

Abandoning; we've stopped producing Theora derivatives due to ongoing issues with nearly-unmaintained ffmpeg2theora.