Class: ButterCut::FCP7
- Inherits:
-
EditorBase
- Object
- EditorBase
- ButterCut::FCP7
- Defined in:
- lib/buttercut/fcp7.rb
Overview
Final Cut Pro 7 XML Interchange Format (version 5). This structure can be imported by legacy FCP as well as Adobe Premiere Pro.
Constant Summary
Constants inherited from EditorBase
EditorBase::DEFAULT_INITIAL_OFFSET, EditorBase::DEFAULT_START_TIME, EditorBase::DEFAULT_VOLUME_ADJUSTMENT
Instance Attribute Summary
Attributes inherited from EditorBase
#clips, #initial_offset, #volume_adjustment
Instance Method Summary collapse
Methods inherited from EditorBase
#add_fractions, #audio_sample_rate, #build_asset_map, #build_timeline_clips, #clip_timecode_fraction, #clip_timecode_string, #color_space, #drop_frame_timecode?, #drop_frames_for_rate, #duration_to_fraction, #escape_xml, #extract_metadata, #format_audio_rate, #format_color_space, #format_frame_duration, #format_frame_rate, #format_height, #format_nominal_frame_rate, #format_width, #fraction_to_rational, #frame_duration, #frame_duration_rational_for, #frame_rate, #frames_for_fraction, #gcd, #generate_uuid, #get_absolute_path, #get_basename, #get_filename, #initialize, #nominal_frame_rate, #path_to_file_url, #round_to_frame_boundary, #save, #seconds_to_fraction, #subtract_fractions, #time_value_zero?, #video_duration, #video_height, #video_width
Constructor Details
This class inherits a constructor from ButterCut::EditorBase
Instance Method Details
#to_xml ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/buttercut/fcp7.rb', line 8 def to_xml raise ArgumentError, "No clips provided" if clips.empty? asset_map = build_asset_map timeline_frame_duration = format_frame_duration timeline_clips, sequence_duration_fraction = build_timeline_clips(asset_map, timeline_frame_duration) rate_num, rate_denom = format_frame_rate.split('/').map(&:to_i) timebase = format_nominal_frame_rate ntsc_flag = ntsc_flag_for(rate_denom) drop_frame = drop_frame_rate?(rate_num, rate_denom) display_format = drop_frame ? 'DF' : 'NDF' sequence_duration_frames = frames_for_fraction(sequence_duration_fraction, timeline_frame_duration) sequence_uuid = generate_uuid sequence_id = "sequence-#{sequence_uuid}" first_path = clips.first[:path] sequence_name = "#{get_basename(get_filename(first_path))} #{}" clip_payloads = build_clip_payloads(timeline_clips, timeline_frame_duration) sequence_audio_rate = format_audio_rate || '48000' builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml| xml.doc.create_internal_subset('xmeml', nil, nil) xml.xmeml(version: '5') do xml.sequence(id: sequence_id) do xml.uuid sequence_uuid xml.name sequence_name xml.duration sequence_duration_frames xml.rate do xml.timebase timebase xml.ntsc ntsc_flag end xml.in 0 xml.out sequence_duration_frames xml.timecode do xml.rate do xml.timebase timebase xml.ntsc ntsc_flag end xml.frame 0 xml.displayformat display_format end xml.media do xml.video do xml.format do xml.samplecharacteristics do xml.rate do xml.timebase timebase xml.ntsc ntsc_flag end xml.width format_width xml.height format_height xml.anamorphic 'FALSE' xml.pixelaspectratio 'square' xml.fielddominance 'none' end end xml.track do clip_payloads.each do |payload| build_video_clipitem(xml, payload) end end end xml.audio do xml.numOutputChannels 2 xml.format do xml.samplecharacteristics do xml.samplerate sequence_audio_rate xml.sampledepth 16 end end xml.track do clip_payloads.each do |payload| build_audio_clipitem(xml, payload) end end end end end end end builder.to_xml end |