Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/g-corp/vice

[MIRROR] Video, audio and Image Converter for Erlang/Elixir
https://github.com/g-corp/vice

Last synced: about 1 month ago
JSON representation

[MIRROR] Video, audio and Image Converter for Erlang/Elixir

Awesome Lists containing this project

README

        

# VICE - Video, audio and Image Converter for Erlang/Elixir #

Copyright (c) 2014-2016 Grégoire Lejeune, 2016 Botsunit, 2017-2018 G-Corp

__Version:__ 0.1.0

__Authors:__ Gregoire Lejeune ([`[email protected]`](mailto:[email protected])).

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg)](#contributors)
[![Hex.pm](https://img.shields.io/hexpm/v/vice.svg)](https://hex.pm/packages/vice)

### VICE ###

VICE is a fork and rewrite of [erlffmpeg](https://github.com/emedia-project/erlffmpeg).

#### Install ####

[cmake](https://cmake.org/), [ffmpeg](https://www.ffmpeg.org/)|[libav](https://www.libav.org/), [libopencv-dev](http://opencv.org/), [imagemagick](https://www.imagemagick.org/script/index.php), [SoX](http://sox.sourceforge.net/)

#### Example ####

```

1> vice:start().
...
2> {async, Worker} = vice:convert("test/erlang.mp4", "erlang.webm").
...
3> vice:status(Worker).
{running, 9.131803868645973}
3> vice:status(Worker).
{running, 22.89698605488079}
...

```

### Common options ###

TypeNameDescriptionValueExample

global
cgroup
Execute encoder in the given cgroup.
string() | binary()
{cgroup, "cpu:/erlang.vice"}

global
cgexec
Path to the cgexec executable.
string() | binary()
{cgexec, "/usr/bin/cgexec"}

global
type
Allow you to force the input type.
video | audio | image
{cgexec, "/usr/bin/cgexec"}

### Video ###

For video conversion, VICE use [FFmpeg](https://www.ffmpeg.org).

#### Options ####

TypeNameDescriptionValueExample

global
preset
Use a given preset file.
string() | atom()
{preset, hls1080p}

global
global_params
Global parameters.
[{atom(), term()}]
[{framerate, 25}, {bitrate, 3950}]

global
yes
Overwrite output files without asking.
true | false
{yes, true}

global
fix_sub_duration
Fix subtitles durations. For each subtitle, wait for the next packet in the same stream and adjust the duration of the first to avoid overlap.
true | false
{fix_sub_duration, true}

global
canvas_size
Set the size of the canvas used to render subtitles.
integer()
{canvas_size, 10}

global
filter_complex
Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or outputs.
Filtergraph :: string() | binary() | proplist()
{filter_complex, [{"acrossfade", "d=10"}, {"c1", "exp"}, {"c2", "exp"}]}

global
filter_complex_script
This option is similar to filter_complex, the only difference is that its argument is the name of the file from which a complex filtergraph description is to be read.
Script :: file:filename_all()
{filter_complex_script, "filter.script"}

global
allowed_extensions
List of file extensions that dash or hls is allowed to access.
Extensions :: string() | binary()
{allowed_extensions, "vtt,aac,ts,key"}

input
input_position
Seeks in this input file to position.
position :: string() | binary()
{input_position, "00:01:02.123"}

input
input_eof_position
Like the input_position option but relative to the "end of file". That is negative values are earlier in the file, 0 is at EOF. .
position :: string() | binary()
{input_eof_position, "-0:32:01.123"}

input
input_format
Force input format.
Format :: string()
{input_format, "mp4"}

input
input_duration
Limit the duration of data read from the input file.
position :: string() | binary()
{input_duration, "0:32:01.123"}

input
decoder
Select a decoder for one or more streams.
[Stream :: string(), Codec :: string()]
{decoder, ["a", "pcm_s161e"]}

input
itoffset
Set the input time offset.
position :: string() | binary()
{itoffset, "+12.345"}

input
input_frame_rate
Set frame rate (Hz value, fraction or abbreviation).
[Stream :: string(), FPS :: integer()] | FPS :: integer()
{input_frame_rate, 25}

input
input_frame_size
Set frame size.
[Stream :: string(), Size :: integer()] | Size :: integer()
{input_frame_size, ["v", 1]}

input
input_pixel_format
Set pixel format.
[Stream :: string(), Format :: string()] | Format :: string() | binary()
{input_pixel_format, "rgb24"}

input
input_sws_flags
Set SwScaler flags.
Flags :: string() | binary()
{input_sws_flags, "gauss"}

input
input_audio_frequency
Set the audio sampling frequency.
[Stream :: string(), Freq :: integer()] | Freq :: integer()
{input_audio_frequency, ["a:1", 22050]}

input
input_audio_channels
Set the number of audio channels.
[Stream :: string(), Channels :: integer()] | Channels :: integer()
{input_audio_channels, 6}

input
input_acodec
Set the audio codec.
Codec :: string() | binary()
{input_acodec, "pcm_s24le"}

input
guess_layout_max
If some input channel layout is not known, try to guess only if it corresponds to at most the specified number of channels.
Channels :: integer()
{guess_layout_max, 2}

input
input_vcodec
Set the video codec.
Codec :: string() | binary()
{input_vcodec, "libxvid"}

input
input_scodec
Set the subtitle codec.
Codec :: string() | binary()
{input_scodec, "srt"}

input
muxdelay
Set the maximum demux-decode delay.
Delay :: float() | integer()
{muxdelay, 0.1}

input
muxpreload
Set the initial demux-decode delay.
Delay :: float() | integer()
{muxpreload, 0.1}

input
accurate_seek
This option enables or disables accurate seeking in input files with the output_position option.
true | false
{accurate_seek, false}

output
output_format
Force output format.
Format :: string()
{output_format, "mp4"}

output
output_duration
Limit the duration of data read from the output file.
position :: string() | binary()
{output_duration, "0:32:01.123}

output
output_position
Seeks in this output file to position.
position :: string() | binary()
{output_position, "00:01:02.123}

output
output_eof_position
Like the output_position option but relative to the "end of file". That is negative values are earlier in the file, 0 is at EOF. .
position :: string() | binary()
{output_eof_position, "-0:32:01.123}

output
encoder
Select a encoder for one or more streams.
[Stream :: string(), Codec :: string()] | Codec :: string()
{encoder, ["a", "pcm_s161e"]}

output
bitrate
Set bitrate.
[Stream :: string(), Bitrate :: string()] | [Stream :: string(), Number :: integer(), Bitrate :: string()] | Bitrate :: string() | integer()
{bitrate, ["v", 0, "800k"]}

output
timestamp
Set the recording timestamp in the container.
Date :: date()

output
target
Specify target file type (vcd, svcd, dvd, dv, dv50). type may be prefixed with pal-, ntsc- or film- to use the corresponding standard.
Target :: string()
{target, "vcd"}

output
frames
Stop writing to the stream after framecount frames.
[Stream :: string(), Framecount :: integer()] | Framecount :: integer()
{frames, ["v", 1]}

output
qscale
Use fixed quality scale (VBR).
[Stream :: string(), Quality :: integer()] | [Stream :: string(), Number :: integer(), Quality :: integer()] | Quality :: integer()

output
filter
Create the filtergraph specified by filtergraph and use it to filter the stream.
[Stream :: string(), Filtergraph :: string()]

output
filter_script


output
pre


output
vframes


output
output_frame_rate


output
output_frame_size


output
aspect


output
no_video_recording


output
vcodec


output
pass


output
vlang


output
video_filtergraph


output
output_pixel_format


output
output_sws_flags


output
rc_override


output
top


output
force_key_frames


output
copyinkf


output
aframes


output
output_audio_frequency


output
audio_quality


output
output_audio_channels


output
no_audio_recording


output
output_acodec


output
sample_fmt


output
audio_filtergraph


output
output_scodec


output
no_subtitle_recording


output
map


output
map_channel


output
map_chapters


output
vsync


output
async


output
copytb


output
shortest


output
dts_delta_threshold


output
streamid


output
bitstream_filters


output
timecode


output
strict


output
metadata


output
disable_video


output
disable_audio


output
disable_subtitle


output
x264_profile


output
x264_level


output
x264_refs


output
start_number


output
hls_list_size


output
hls_key_info_file


output
hls_key_info

[{key_uri, string()}, {enc_key, string() | file:filename_all()}, {iv, string()}]

output
hls_playlist_type


output
hls_segment_filename


output
hls_time


### Video Thumbnails ###

To generate video thumbnails, VICE use [ImageMagick](https://www.imagemagick.org)
[®](http://tarr.uspto.gov/servlet/tarr?regser=serial&entry=78333969)
and [FFmpeg](https://www.ffmpeg.org). If you want to _optimize_ output images, you must add [image_optimizer](https://github.com/G-Corp/image_optimizer) in your project dependencies and install [pngquand](https://pngquant.org/) or [OptiPNG](http://optipng.sourceforge.net/).

#### Options ####

TypeNameDescriptionValueExample

global
every
Generate a thumbnail _every_ seconds.
integer()
{every, 6}

global
width
Thumbnail image width.
integer()
{width, 100}

global
out_path
Output path.
string() | binary()
{out_path, "my_folder"}

global
assets_path
Assets path.
string() | binary()
{assets_path, "http://mysite.com/video/1/thumbnails"}

global
sprite
Generate a single image.
true | false
{sprite, true}

### Audio ###

For audio conversion, VICE use [SoX](http://sox.sourceforge.net/).

#### Options ####

TypeNameDescriptionValueExample

global
buffer or input_buffer
Set the size in bytes of the buffers used for processing audio (default 8192).
Bytes :: integer()
{buffer, 20000}

global
clobber
Don’t prompt before overwriting an existing file with the same name as that given for the output file.
true | false
{clobber, false}

global
combine
Select the input file combining method.
concatenate | merge | mix | 'mix−power' | multiply | sequence
{combine, concatenate}

global
no_dither
Disable automatic dither.
true | false
{no_dither, true}

global
effects_file
Use File to obtain all effects and their arguments.
File :: file:filename_all()
{effects_file, "effects.data"}

global
guard
Automatically invoke the gain effect to guard against clipping.
true | false
{guard, true}

global
magic
If SoX has been built with the optional libmagic library then this option can be given to enable its use in helping to detect audio file types.
true | false
{magic, true}

global
multi_threaded
By default, SoX is single threaded. If the multi_threaded option is given however then SoX will process audio channels for most multi-channel effects in parallel on hyper-threading/multi-core architectures.
true | false
{multi_threaded, true}

global
single_threaded
Opposite of the multi_threaded option.
true | false
{single_threaded, true}

global
norm
Automatically invoke the gain effect to guard against clipping and to normalise the audio.
DBLevel :: integer() | true
{norm, true}

global
play_rate_arg
Selects a quality option to be used when the rate effect is automatically invoked whilst playing audio.
Arg :: string()

global
plot
If not set to off (the default if plot is not given), run in a mode that can be used, in conjunction with the gnuplot program or the GNU Octave program, to assist with the selection and configuration of many of the transfer-function based effects.
gnuplot | octave | off
{plot, gnuplot}

global
repeatable
VICE will embed a fixed time-stamp in the output file (e.g. AIFF) and will seed pseudo random number generators (e.g. dither) with a fixed number, thus ensuring that successive SoX invocations with the same inputs and the same parameters yield the same output.
true | false
{repeatable, true}

global
replay_gain
Select whether or not to apply replay-gain adjustment to input files.
track | album | off
{replay_gain, track}

global
temp
Specify that any temporary files should be created in the given Directory.
Directory :: string()
{temp, "/home/vice/tmp"}

input
ignore_length
Override an (incorrect) audio length given in an audio file’s header.
true | false
{ignore_length, true}

input
volume
Intended for use when combining multiple input files, this option adjusts the volume of the file that follows it on the command line by a factor of Factor.
{volume, Factor :: float()}
{volume, 0.8}

input
input_bits
The number of bits (a.k.a. bit-depth or sometimes word-length) in each encoded sample.
Bytes :: integer()
{input_bits, 8}

input
input_channels
The number of audio channels in the audio file.
Channels :: integer()
{input_channels, 2}}

input
input_encoding
The audio encoding type.
Encoding :: string()
{input_encoding, "float"}

input
input_rate
Gives the sample rate in Hz of the file.
Rate :: integer()
{input_rate, 48720}

input
input_rate_k
Gives the sample rate in kHz of the file.
KRate :: integer()
{input_rate_k, 48}

input
input_type
Gives the type of the audio file.
Filetype :: string()
{input_type, "mp3"}

input
input_endian
Specify the byte-order of the audio data.
little | bug | swap
{input_endian, little}

input
input_reverse_nibbles
Specifies that the nibble ordering (i.e. the 2 halves of a byte) of the samples should be reversed.
true | false
{input_reverse_nibbles, true}

input
input_reverse_bits
Specifies that the bit ordering of the samples should be reversed.
true | false
{input_reverse_bits, true}

output
output_encoding
The audio encoding type.
Encoding :: string()
{output_encoding, "float"}

output
output_bits
The number of bits (a.k.a. bit-depth or sometimes word-length) in each encoded sample.
Bytes :: integer()
{output_bits, 8}

output
output_channels
The number of audio channels in the audio file.
Channels :: integer()
{output_channels, 2}}

output
output_rate
Gives the sample rate in Hz of the file.
Rate :: integer()
{output_rate, 48720}

output
output_rate_k
Gives the sample rate in kHz of the file.
KRate :: integer()
{output_rate_k, 48}

output
output_type
Gives the type of the audio file.
Filetype :: string()
{output_type, "mp3"}

output
output_endian
Specify the byte-order of the audio data.
little | bug | swap
{output_endian, little}

output
output_reverse_nibbles
Specifies that the nibble ordering (i.e. the 2 halves of a byte) of the samples should be reversed.
true | false
{output_reverse_nibbles, true}

output
output_reverse_bits
Specifies that the bit ordering of the samples should be reversed.
true | false
{output_reverse_bits, true}

output
add_comment
Append a comment in the output file header (where applicable).
Text :: string()
{add_comment, "Encoded by VICE"}

output
comment
Specify the comment text to store in the output file header (where applicable).
Text :: string()
{comment, "Encoded by VICE"}

output
comment_file
Specify a file containing the comment text to store in the output file header (where applicable).
File :: file:filename_all()
{comment_file, "/home/vice/comment.txt"}

output
compression
The compression factor for variably compressing output file formats.
Factor :: integer()
{compression, 2}

effects
effects
Audio effects to invoke (see Effects).
Effects :: string()
{effects, "chorus 0.7 0.9 55 0.4 0.25 2"}

### Image ###

For image conversion, VICE use [ImageMagick](https://www.imagemagick.org)
[®](http://tarr.uspto.gov/servlet/tarr?regser=serial&entry=78333969)
.

#### Options ####

TypeNameDescriptionValueExample

convert
resize
Resize image
{resize, P :: integer(), percent | pixel} | {resize, W :: integer(), H :: integer()} | {resize, W :: integer(), H :: integer(), percent | ignore_ration | no_enlarge | no_shrink | fill}
{resize, 50, percent}

convert
thumbnail
Create a thumbnail of the image. This is similar to resize, except it is optimized for speed and any image profile, other than a color profile, is removed to reduce the thumbnail size.
{thumbnail, P :: integer(), percent | pixel} | {thumbnail, W :: integer(), H :: integer()} | {thumbnail, W :: integer(), H :: integer(), percent | ignore_ration | no_enlarge | no_shrink | fill}
{thumbnail, 100, 100, no_enlarge}

convert
quality


convert
crop
Cut out a rectangular region of the image.
{crop, W :: integer(), H :: integer(), X :: integer(), Y :: integer()} | {crop, W :: integer(), H :: integer()}
{crop, 100, 80, 20, 30}

convert
gravity
Sets the current gravity suggestion for various other settings and options. Choices include: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast
{gravity, Gravity :: string()}
{gravity, "SouthEast"}

convert
repage or '+repage'
Adjust the canvas and offset information of the image
-
repage

convert
flip
Create a mirror image
-
flip

convert
trim
Trim an image
-
trim

convert
magnify
Double the size of the image with pixel art scaling
-
magnify

convert
rotation
Apply Paeth image rotation (using shear operations) to the image
{rotation, Degrees :: integer()}
{rotation, 90}

convert
'auto-orient'
Adjusts an image so that its orientation is suitable for viewing
-
'auto-orient'

convert
strip
Strip the image of any profiles, comments or these PNG chunks: bKGD,cHRM,EXIF,gAMA,iCCP,iTXt,sRGB,tEXt,zCCP,zTXt,date.
-
strip

convert
blur
Reduce image noise and reduce detail levels
{blur, Radius :: integer()} | {blur, Radius :: integer(), Sigma :: integer()}
{blur, 0, 8}

convert
edge
Detect edges within an image
{edge, Radius :: integer()}
{edge 3}

convert
size
Set the width and height of the image
{size, Width} | {size, Width :: integer(), Height :: integer()} | {size, Width :: integer(), Height :: integer(), Offset :: integer()}
{size, 192, 128}

convert
extent
Set the image size and offset
{extent, Width :: integer(), Height :: integer()}
{extent, 384, 256}

mogrify
geometry
Set the preferred size and location of the image.
{geometry, Scale :: integer(), percent} | {geometry, Area :: integer(), pixels} | {geometry, ScaleX :: integer(), ScaleY :: integer(), percent} | {geometry, Width :: integer()} | {geometry, Width :: integer(), undefined} | {geometry, undefined, Height :: integer()} | {geometry, Width :: integer(), Height :: integer()} | {geometry, Width :: integer(), Height :: integer(), ignore_ration | no_enlarge | no_shrink | fill} | {geometry, Width :: integer(), Height :: integer(), X :: integer(), Y :: integer()}
{geometry, 325, 192, 10, 10}

montage
geometry
Set the preferred size and location of the image.
{geometry, Scale :: integer(), percent} | {geometry, Area :: integer(), pixels} | {geometry, ScaleX :: integer(), ScaleY :: integer(), percent} | {geometry, Width :: integer()} | {geometry, Width :: integer(), undefined} | {geometry, undefined, Height :: integer()} | {geometry, Width :: integer(), Height :: integer()} | {geometry, Width :: integer(), Height :: integer(), ignore_ration | no_enlarge | no_shrink | fill} | {geometry, Width :: integer(), Height :: integer(), X :: integer(), Y :: integer()}
{geometry, 10, percent}

montage
tile
Specify the layout of images.
{tile, Scale :: integer(), percent} | {tile, Area :: integer(), pixels} | {tile, ScaleX :: integer(), ScaleY :: integer(), percent} | {tile, Width :: integer()} | {tile, Width :: integer(), undefined} | {tile, undefined, Height :: integer()} | {tile, Width :: integer(), Height :: integer()} | {tile, Width :: integer(), Height :: integer(), ignore_ration | no_enlarge | no_shrink | fill} | {tile, Width :: integer(), Height :: integer(), X :: integer(), Y :: integer()}
{tile, 234, 186, ignore_ration}

### Licence ###

VICE is available for use under the following license, commonly known as the 3-clause (or "modified") BSD license:

Copyright (c) 2014-2015 Grégoire Lejeune

Copyright (c) 2016 BotsUnit

Copyright (c) 2017-2018 G-Corp

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## Modules ##

vice
vice_encoder
vice_subtitles
vice_thumbnails

## Contributors ##

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

Gregoire Lejeune
Gregoire Lejeune

💻 🎨 📖 ⚠️Augustin G
Augustin G

💻 ⚠️P
P

💻 📖

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!