Module: FFMpeg::AudioOptions
- Included in:
- FFMpeg
- Defined in:
- lib/ffmpeg/audio_options.rb
Instance Method Summary collapse
-
#audio_bitrate(bitrate) ⇒ Object
Set the audio bitrate in bit/s (default = 64k).
-
#audio_channels(number) ⇒ Object
Set the number of audio channels (default = 1).
-
#audio_codec(codec) ⇒ Object
Force audio codec to codec.
-
#audio_frames(number) ⇒ Object
Set the number of audio frames to record.
-
#audio_language(code) ⇒ Object
Set the ISO 639 language code (3 letters) of the current audio stream.
-
#audio_sampling(frequency) ⇒ Object
Set the audio sampling frequency (default = 44100 Hz).
-
#disable_audio ⇒ Object
Disable audio recording.
-
#new_audio ⇒ Object
Add a new audio track to the output file.
Instance Method Details
#audio_bitrate(bitrate) ⇒ Object
Set the audio bitrate in bit/s (default = 64k).
14 15 16 |
# File 'lib/ffmpeg/audio_options.rb', line 14 def audio_bitrate(bitrate) FFMpegCommand << "-ab #{bitrate}" end |
#audio_channels(number) ⇒ Object
Set the number of audio channels (default = 1).
19 20 21 |
# File 'lib/ffmpeg/audio_options.rb', line 19 def audio_channels(number) FFMpegCommand << "-ac #{number}" end |
#audio_codec(codec) ⇒ Object
Force audio codec to codec. Use the copy special value to specify that the raw codec data must be copied as is.
29 30 31 |
# File 'lib/ffmpeg/audio_options.rb', line 29 def audio_codec(codec) FFMpegCommand << "-acodec #{codec}" end |
#audio_frames(number) ⇒ Object
Set the number of audio frames to record.
4 5 6 |
# File 'lib/ffmpeg/audio_options.rb', line 4 def audio_frames(number) FFMpegCommand << "-aframes #{number}" end |
#audio_language(code) ⇒ Object
Set the ISO 639 language code (3 letters) of the current audio stream.
43 44 45 |
# File 'lib/ffmpeg/audio_options.rb', line 43 def audio_language(code) FFMpegCommand << "-alang #{code}" end |
#audio_sampling(frequency) ⇒ Object
Set the audio sampling frequency (default = 44100 Hz).
9 10 11 |
# File 'lib/ffmpeg/audio_options.rb', line 9 def audio_sampling(frequency) FFMpegCommand << "-ar #{frequency}" end |
#disable_audio ⇒ Object
Disable audio recording.
24 25 26 |
# File 'lib/ffmpeg/audio_options.rb', line 24 def disable_audio FFMpegCommand << "-an" end |
#new_audio ⇒ Object
Add a new audio track to the output file. If you want to specify parameters, do so before -newaudio (-acodec, -ab, etc..). Mapping will be done automatically, if the number of output streams is equal to the number of input streams, else it will pick the first one that matches. You can override the mapping using -map as usual. Example:
ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
38 39 40 |
# File 'lib/ffmpeg/audio_options.rb', line 38 def new_audio FFMpegCommand << "-newaudio" end |