Class: FFMPEG::Configuration
- Inherits:
-
Object
- Object
- FFMPEG::Configuration
- Defined in:
- lib/ffmpeg/configuration.rb
Overview
Configuration options for FFMPEG
Instance Attribute Summary collapse
-
#default_audio_codec ⇒ String
Default audio codec for transcoding.
-
#default_format ⇒ String
Default output format.
-
#default_video_codec ⇒ String
Default video codec for transcoding.
-
#ffmpeg_binary ⇒ String
Path to ffmpeg binary.
-
#ffprobe_binary ⇒ String
Path to ffprobe binary.
-
#hardware_acceleration ⇒ Symbol?
Hardware acceleration type (nil, :cuda, :videotoolbox, :vaapi, :qsv).
-
#logger ⇒ Logger?
Logger for debug output.
-
#overwrite_output ⇒ Boolean
Whether to overwrite existing output files.
-
#temp_dir ⇒ String
Temporary directory for intermediate files.
-
#threads ⇒ Integer
Number of threads to use (0 = auto).
-
#timeout ⇒ Integer
Default timeout for commands in seconds.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ Object
Reset configuration to defaults.
-
#validate! ⇒ Object
Validate configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ffmpeg/configuration.rb', line 61 def initialize @ffmpeg_binary = find_binary("ffmpeg") @ffprobe_binary = find_binary("ffprobe") @timeout = 600 # 10 minutes default @logger = nil @default_video_codec = "libx264" @default_audio_codec = "aac" @default_format = "mp4" @threads = 0 # auto @hardware_acceleration = nil @temp_dir = Dir.tmpdir @overwrite_output = true end |
Instance Attribute Details
#default_audio_codec ⇒ String
Default audio codec for transcoding
39 40 41 |
# File 'lib/ffmpeg/configuration.rb', line 39 def default_audio_codec @default_audio_codec end |
#default_format ⇒ String
Default output format
43 44 45 |
# File 'lib/ffmpeg/configuration.rb', line 43 def default_format @default_format end |
#default_video_codec ⇒ String
Default video codec for transcoding
35 36 37 |
# File 'lib/ffmpeg/configuration.rb', line 35 def default_video_codec @default_video_codec end |
#ffmpeg_binary ⇒ String
Path to ffmpeg binary
19 20 21 |
# File 'lib/ffmpeg/configuration.rb', line 19 def ffmpeg_binary @ffmpeg_binary end |
#ffprobe_binary ⇒ String
Path to ffprobe binary
23 24 25 |
# File 'lib/ffmpeg/configuration.rb', line 23 def ffprobe_binary @ffprobe_binary end |
#hardware_acceleration ⇒ Symbol?
Hardware acceleration type (nil, :cuda, :videotoolbox, :vaapi, :qsv)
51 52 53 |
# File 'lib/ffmpeg/configuration.rb', line 51 def hardware_acceleration @hardware_acceleration end |
#logger ⇒ Logger?
Logger for debug output
31 32 33 |
# File 'lib/ffmpeg/configuration.rb', line 31 def logger @logger end |
#overwrite_output ⇒ Boolean
Whether to overwrite existing output files
59 60 61 |
# File 'lib/ffmpeg/configuration.rb', line 59 def overwrite_output @overwrite_output end |
#temp_dir ⇒ String
Temporary directory for intermediate files
55 56 57 |
# File 'lib/ffmpeg/configuration.rb', line 55 def temp_dir @temp_dir end |
#threads ⇒ Integer
Number of threads to use (0 = auto)
47 48 49 |
# File 'lib/ffmpeg/configuration.rb', line 47 def threads @threads end |
#timeout ⇒ Integer
Default timeout for commands in seconds
27 28 29 |
# File 'lib/ffmpeg/configuration.rb', line 27 def timeout @timeout end |
Instance Method Details
#reset! ⇒ Object
Reset configuration to defaults
76 77 78 |
# File 'lib/ffmpeg/configuration.rb', line 76 def reset! initialize end |
#validate! ⇒ Object
Validate configuration
83 84 85 86 87 88 |
# File 'lib/ffmpeg/configuration.rb', line 83 def validate! raise FFmpegNotFound, @ffmpeg_binary unless binary_exists?(@ffmpeg_binary) raise FFprobeNotFound, @ffprobe_binary unless binary_exists?(@ffprobe_binary) true end |