2012-09-14 15:51:26 +00:00
|
|
|
General usage
|
|
|
|
=============
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv infile --o=outfile [--of=outfileformat] [--ofopts=formatoptions] [--orawts] \
|
2012-10-11 00:04:08 +00:00
|
|
|
[(any other mpv options)] \
|
2022-05-16 21:49:13 +00:00
|
|
|
--ovc=outvideocodec [--ovcopts=outvideocodecoptions] \
|
|
|
|
--oac=outaudiocodec [--oacopts=outaudiocodecoptions]
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
Help for these options is provided if giving help as parameter, as in::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv --ovc=help
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
The suboptions of these generally are identical to ffmpeg's (as option parsing
|
2022-05-16 21:49:13 +00:00
|
|
|
is simply delegated to ffmpeg). The option --ocopyts enables copying timestamps
|
2012-09-14 15:51:26 +00:00
|
|
|
from the source as-is, instead of fixing them to match audio playback time
|
2022-05-16 21:49:13 +00:00
|
|
|
(note: this doesn't work with all output container formats); --orawts even turns
|
2012-09-14 15:51:26 +00:00
|
|
|
off discontinuity fixing.
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
Note that if neither --ofps nor --oautofps is specified, VFR encoding is assumed
|
|
|
|
and the time base is 24000fps. --oautofps sets --ofps to a guessed fps number
|
2012-09-14 15:51:26 +00:00
|
|
|
from the input video. Note that not all codecs and not all formats support VFR
|
|
|
|
encoding, and some which do have bugs when a target bitrate is specified - use
|
2022-05-16 21:49:13 +00:00
|
|
|
--ofps or --oautofps to force CFR encoding in these cases.
|
2012-09-14 15:51:26 +00:00
|
|
|
|
2014-06-28 13:55:09 +00:00
|
|
|
Of course, the options can be stored in a profile, like this .config/mpv/mpv.conf
|
2012-09-14 15:51:26 +00:00
|
|
|
section::
|
|
|
|
|
|
|
|
[myencprofile]
|
|
|
|
vf-add = scale=480:-2
|
|
|
|
ovc = libx264
|
2020-01-04 22:41:32 +00:00
|
|
|
ovcopts-add = preset=medium
|
|
|
|
ovcopts-add = tune=fastdecode
|
2012-09-14 15:51:26 +00:00
|
|
|
ovcopts-add = crf=23
|
2020-01-04 22:41:32 +00:00
|
|
|
ovcopts-add = maxrate=1500k
|
|
|
|
ovcopts-add = bufsize=1000k
|
|
|
|
ovcopts-add = rc_init_occupancy=900k
|
|
|
|
ovcopts-add = refs=2
|
2012-09-14 15:51:26 +00:00
|
|
|
ovcopts-add = profile=baseline
|
|
|
|
oac = aac
|
|
|
|
oacopts-add = b=96k
|
|
|
|
|
2014-04-19 20:05:17 +00:00
|
|
|
It's also possible to define default encoding options by putting them into
|
|
|
|
the section named ``[encoding]``. (This behavior changed after mpv 0.3.x. In
|
|
|
|
mpv 0.3.x, config options in the default section / no section were applied
|
|
|
|
to encoding. This is not the case anymore.)
|
|
|
|
|
2012-09-14 15:51:26 +00:00
|
|
|
One can then encode using this profile using the command::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv infile --o=outfile.mp4 --profile=myencprofile
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
Some example profiles are provided in a file
|
2013-12-28 15:32:49 +00:00
|
|
|
etc/encoding-profiles.conf; as for this, see below.
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
Encoding examples
|
|
|
|
=================
|
|
|
|
|
|
|
|
These are some examples of encoding targets this code has been used and tested
|
|
|
|
for.
|
|
|
|
|
|
|
|
Typical MPEG-4 Part 2 ("ASP", "DivX") encoding, AVI container::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv infile --o=outfile.avi \
|
2018-04-29 00:55:27 +00:00
|
|
|
--vf=fps=25 \
|
2022-05-16 21:49:13 +00:00
|
|
|
--ovc=mpeg4 --ovcopts=qscale=4 \
|
|
|
|
--oac=libmp3lame --oacopts=b=128k
|
2012-09-14 15:51:26 +00:00
|
|
|
|
2018-04-29 00:55:27 +00:00
|
|
|
Note: AVI does not support variable frame rate, so the fps filter must be used.
|
|
|
|
The frame rate should ideally match the input (25 for PAL, 24000/1001 or
|
|
|
|
30000/1001 for NTSC)
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
Typical MPEG-4 Part 10 ("AVC", "H.264") encoding, Matroska (MKV) container::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv infile --o=outfile.mkv \
|
|
|
|
--ovc=libx264 --ovcopts=preset=medium,crf=23,profile=baseline \
|
|
|
|
--oac=libopus --oacopts=qscale=3
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
Typical MPEG-4 Part 10 ("AVC", "H.264") encoding, MPEG-4 (MP4) container::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv infile --o=outfile.mp4 \
|
|
|
|
--ovc=libx264 --ovcopts=preset=medium,crf=23,profile=baseline \
|
|
|
|
--oac=aac --oacopts=b=128k
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
Typical VP8 encoding, WebM (restricted Matroska) container::
|
|
|
|
|
2012-10-11 00:04:08 +00:00
|
|
|
mpv infile -o outfile.mkv \
|
2022-05-16 21:49:13 +00:00
|
|
|
--of=webm \
|
|
|
|
--ovc=libvpx --ovcopts=qmin=6,b=1000000k \
|
|
|
|
--oac=libopus --oacopts=qscale=3
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
Device targets
|
|
|
|
==============
|
|
|
|
|
|
|
|
As the options for various devices can get complex, profiles can be used.
|
|
|
|
|
|
|
|
An example profile file for encoding is provided in
|
2013-12-28 15:32:49 +00:00
|
|
|
etc/encoding-profiles.conf in the source tree. This file is installed and loaded
|
2017-07-12 11:11:14 +00:00
|
|
|
by default. If you want to modify it, you can replace and it with your own copy
|
|
|
|
by doing::
|
2012-09-14 15:51:26 +00:00
|
|
|
|
2012-10-11 00:04:08 +00:00
|
|
|
mkdir -p ~/.mpv
|
2013-12-28 15:32:49 +00:00
|
|
|
cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
|
2012-09-14 15:51:26 +00:00
|
|
|
|
2017-07-12 11:11:14 +00:00
|
|
|
Keep in mind that the default profile is the playback one. If you want to add
|
|
|
|
options that apply only in encoding mode, put them into a ``[encoding]``
|
|
|
|
section.
|
|
|
|
|
2012-09-14 15:51:26 +00:00
|
|
|
Refer to the top of that file for more comments - in a nutshell, the following
|
|
|
|
options are added by it::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
--profile=enc-to-dvdpal # DVD-Video PAL, use dvdauthor -v pal+4:3 -a ac3+en
|
|
|
|
--profile=enc-to-dvdntsc # DVD-Video NTSC, use dvdauthor -v ntsc+4:3 -a ac3+en
|
|
|
|
--profile=enc-to-bb-9000 # MP4 for Blackberry Bold 9000
|
|
|
|
--profile=enc-to-nok-6300 # 3GP for Nokia 6300
|
|
|
|
--profile=enc-to-psp # MP4 for PlayStation Portable
|
|
|
|
--profile=enc-to-iphone # MP4 for iPhone
|
|
|
|
--profile=enc-to-iphone-4 # MP4 for iPhone 4 (double res)
|
|
|
|
--profile=enc-to-iphone-5 # MP4 for iPhone 5 (even larger res)
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
You can encode using these with a command line like::
|
|
|
|
|
2022-05-16 21:49:13 +00:00
|
|
|
mpv infile --o=outfile.mp4 --profile=enc-to-bb-9000
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
Of course, you are free to override options set by these profiles by specifying
|
|
|
|
them after the -profile option.
|
|
|
|
|
|
|
|
|
|
|
|
What works
|
|
|
|
==========
|
|
|
|
|
|
|
|
* Encoding at variable frame rate (default)
|
2018-04-29 00:55:27 +00:00
|
|
|
* Encoding at constant frame rate using --vf=fps=RATE
|
2022-05-16 21:49:13 +00:00
|
|
|
* 2-pass encoding (specify flags=+pass1 in the first pass's --ovcopts, specify
|
2012-09-14 15:51:26 +00:00
|
|
|
flags=+pass2 in the second pass)
|
|
|
|
* Hardcoding subtitles using vobsub, ass or srt subtitle rendering (just
|
2012-10-11 00:04:08 +00:00
|
|
|
configure mpv for the subtitles as usual)
|
2022-05-16 21:49:13 +00:00
|
|
|
* Hardcoding any other mpv OSD (e.g. time codes, using --osdlevel=3 and
|
|
|
|
--vf=expand=::::1)
|
2012-09-14 15:51:26 +00:00
|
|
|
* Encoding directly from a DVD, network stream, webcam, or any other source
|
2012-10-11 00:04:08 +00:00
|
|
|
mpv supports
|
2012-09-14 15:51:26 +00:00
|
|
|
* Using x264 presets/tunings/profiles (by using profile=, tune=, preset= in the
|
2022-05-16 21:49:13 +00:00
|
|
|
--ovcopts)
|
2012-10-11 00:04:08 +00:00
|
|
|
* Deinterlacing/Inverse Telecine with any of mpv's filters for that
|
2022-05-16 21:49:13 +00:00
|
|
|
* Audio file converting: mpv --o=outfile.m4a infile.flac --no-video
|
|
|
|
--oac=aac --oacopts=b=320k
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
What does not work yet
|
2014-03-31 22:13:53 +00:00
|
|
|
======================
|
2012-09-14 15:51:26 +00:00
|
|
|
|
|
|
|
* 3-pass encoding (ensuring constant total size and bitrate constraints while
|
|
|
|
having VBR audio; mencoder calls this "frameno")
|
|
|
|
* Direct stream copy
|