# VICE - Video, audio and Image Converter for Erlang/Elixir #
Copyright (c) 2014-2016 Grgoire Lejeune, 2016 Botsunit, 2017-2018 G-Corp
__Version:__ 0.1.0
__Authors:__ Gregoire Lejeune ([`gregoire.lejeune@gmail.com`](https://github.com/G-Corp/vice/blob/master/mailto:gregoire.lejeune@gmail.com)).
[![All Contributors](https://github.com/G-Corp/vice/blob/master/https://img.shields.io/badge/all_contributors-3-orange.svg)](https://github.com/G-Corp/vice/blob/master/#contributors)
[![Hex.pm](https://github.com/G-Corp/vice/blob/master/https://img.shields.io/hexpm/v/vice.svg)](https://github.com/G-Corp/vice/blob/master/https://hex.pm/packages/vice)
### VICE ###
VICE is a fork and rewrite of [erlffmpeg](https://github.com/G-Corp/vice/blob/master/https://github.com/emedia-project/erlffmpeg).
#### Install ####
[cmake](https://github.com/G-Corp/vice/blob/master/https://cmake.org/), [ffmpeg](https://github.com/G-Corp/vice/blob/master/https://www.ffmpeg.org/)|[libav](https://github.com/G-Corp/vice/blob/master/https://www.libav.org/), [libopencv-dev](https://github.com/G-Corp/vice/blob/master/http://opencv.org/), [imagemagick](https://github.com/G-Corp/vice/blob/master/https://www.imagemagick.org/script/index.php), [SoX](https://github.com/G-Corp/vice/blob/master/http://sox.sourceforge.net/)
#### Example ####
```
1> vice:start().
...
2> {async, Worker} = vice:convert("test/erlang.mp4", "erlang.webm").
...
3> vice:status(Worker).
{running, 9.131803868***5973}
3> vice:status(Worker).
{running, 22.896***605488079}
...
```
### Common options ###
### Video ###
For video conversion, VICE use [FFmpeg](https://github.com/G-Corp/vice/blob/master/https://www.ffmpeg.org).
#### Options ####
Type | Name | Description | Value | Example |
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 |
x2***_profile |
|
|
|
output |
x2***_level |
|
|
|
output |
x2***_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://github.com/G-Corp/vice/blob/master/https://www.imagemagick.org)
and [FFmpeg](https://github.com/G-Corp/vice/blob/master/https://www.ffmpeg.org). If you want to _optimize_ output images, you must add [image_optimizer](https://github.com/G-Corp/vice/blob/master/https://github.com/G-Corp/image_optimizer) in your project dependencies and install [pngquand](https://github.com/G-Corp/vice/blob/master/https://pngquant.org/) or [OptiPNG](https://github.com/G-Corp/vice/blob/master/http://optipng.sourceforge.net/).
#### Options ####
### Audio ###
For audio conversion, VICE use [SoX](https://github.com/G-Corp/vice/blob/master/http://sox.sourceforge.net/).
#### Options ####