Please see http://opencast.jira.com/browse/MH-9197 for reference.

Two-pass encoding in ffmpeg consists of two separate steps that have to be 
executed one after the other. The first run only creates metadata but no media 
file which in turn will be created by the second run. The problem is that the 
MH encoder architecture demands that each encoding creates a media file.

To enable two-pass encodings with ffmpeg I enhanced the EncoderEngine interface 
to make the production of a media file _optional_ to an encoder run. 

For example (EncoderEngine)

  File encode(File mediaSource, EncodingProfile format, Map<String, String> 
properties) throws EncoderException;

now has this signature

  Option<File> encode(File mediaSource, EncodingProfile format, Map<String, 
String> properties) throws EncoderException;

This way the first pass does not return something which can be safely detected 
by clients--e.g. the ComposerService--and reacted accordingly upon. To make 
this happen I also introduced a new MediaType for the EncodingProfiles called 
Nothing. This indicates to the encoder (who may be completely agnostic to what 
it actually executes) to discard the result.

Please see also the updated documentation in the default encoding profiles 
properties files.

Find below a profile and a matching workflow example.

# profiles
profile.first-pass.http.name = h.264/mp4 first pass 
profile.first-pass.http.input = visual 
profile.first-pass.http.output = nothing 
profile.first-pass.http.suffix = .ignore
profile.first-pass.http.mimetype = video/mp4 
profile.first-pass.http.ffmpeg.command = -pass 1-passlogfile 
#{out.dir}/passlogfile_ffmpeg -i #{in.video.path} -y /dev/null
 
profile.second-pass.http.name = h.264/mp4 second pass 
profile.second-pass.http.input = visual 
profile.second-pass.http.output = visual 
profile.second-pass.http.suffix = .mp4 
profile.second-pass.http.mimetype = video/mp4 
profile.second-pass.http.ffmpeg.command = -pass 2 -passlogfile 
#{out.dir}/passlogfile_ffmpeg -i #{in.video.path} -y 
#{out.dir}/#{out.name}#{out.suffix}


<!-- workflow operations -->
<!-- first pass -->
    <operation id="compose" fail-on-error="true" 
exception-handler-workflow="error" description="Encoding presentation (screen), 
first pass">
      <configurations>
        <configuration key="source-flavor">presentation/trimmed</configuration>
        <configuration key="target-flavor"/>
        <configuration key="target-tags"/>
        <configuration key="encoding-profile">first-pass.http</configuration>
      </configurations>
    </operation>
<!-- second pass -->
    <operation id="compose" fail-on-error="true" 
exception-handler-workflow="error" description="Encoding presentation (screen), 
second pass">
      <configurations>
        <configuration key="source-flavor">presentation/trimmed</configuration>
        <configuration key="target-flavor">presentation/delivery</configuration>
        <configuration key="target-tags">engage</configuration>
        <configuration key="encoding-profile">second-pass.http</configuration>
      </configurations>
    </operation>


Happy video quality enhancing,
Christoph


_______________________________________________
Matterhorn mailing list
Matterhorn@opencastproject.org
http://lists.opencastproject.org/mailman/listinfo/matterhorn


To unsubscribe please email
matterhorn-unsubscr...@opencastproject.org
_______________________________________________

Reply via email to