Commit Graph

9 Commits

Author SHA1 Message Date
wm4 ea7820ab66 screenshot: move code to open file out of image writer functions
This is a minor simplification. The original intend was to only open a
file if opening the image encoder went well, but this obscure special
case is not worth bothering the image writer functions with more error
handling.
2012-02-29 04:28:27 +01:00
wm4 12c44610ad screenshot: make screenshot filenames configurable
This adds the --screenshot-template option, which specifies a template
for the filename used for a screenshot. The '%' character is parsed as
format specifier. These format specifiers insert metadata into the
filename. For example, '%f' is replaced with the filename of the
currently played file.

The following format specifiers are available:

%n      Insert sequence number (padded with 4 zeros), e.g. "0002".
%0Nn    Like %n, but pad to N zeros (N = 0 to 9).
        %n behaves like %04n.
%#n     Like %n, but reset the sequence counter on every screenshot.
        (Useful if other parts in the template make the resulting
        filename already mostly unique.)
%#0Nn   Use %0Nn and %#n at the same time.
%f      Insert filename of the currently played video.
%F      Like %f, but with stripped file extension ("." and rest).
%p      Insert current playback time, in HH:MM:SS format.
%P      Like %p, but adds milliseconds: HH:MM:SS.mmmm
%tX     Insert the current local date/time, using the date format X.
        X is a single letter and is passed to strftime() as "%X".
        E.g. "%td" inserts the number of the current day.
%{prop} Insert the value of the slave property 'prop'.
        E.g. %{filename} is the same as %f. If the property doesn't
        exist or is not available, nothing is inserted, unless a
        fallback is specified as in %{prop:fallback text}.
%%      Insert the character '%'.

The strings inserted by format specifiers will be checked for
characters not allowed in filenames (including '/' and '\'), and
replaced with the placeholder '_'. (This doesn't happen for text that
was passed with the --screenshot-template option, and allows specifying
a screenshot target directory by prefixing the template with a relative
or absolute path.)
2012-02-29 04:14:54 +01:00
wm4 8b69d8a366 screenshot: allow forcing taking screenshots with the video filter
If the screenshot_force video filter is inserted, taking screenshots will
always use the video filter, and skip the VO specific screenshot code.

This can be useful if the VO code causes problems, or if it's intended to
take screenshots from a specific location in the filter chain.

The 'screenshot' filter is intended as fallback, it's not used if possible.
2012-02-29 03:41:14 +01:00
wm4 7822eca9ac screenshot: fix error message
This happens with JPG screenshots as well.
2012-02-19 16:43:58 +01:00
wm4 316658ad48 screenshot: add png compression setting
The default compression setting is 7, which is hopefully a good balance
between speed of compression, and resulting file sizes. The maximum png
compression will be very slow even on fast computers. On the other hand,
the lowest compression setting produces files of several MB size with
normal video resolutions, which should be avoided as well.
2012-01-18 04:45:27 +01:00
wm4 09cdd1406d screenshot: add jpg support
The screenshot image file type can now be selected with the
--screenshot-filetype option. The --screenshot-jpeg-quality option
controls the compression setting of the written JPEG image file.
2012-01-18 04:45:22 +01:00
wm4 4e76c7514f screenshot: improve quality by using additional swscale flags
Adding these flags improves the quality of the YUV->RGB conversion when
screenshots are taken. It trades precision for performance.

This doesn't affect any other swscale uses, such as vf_scale or vo_x11.

Based on a patch by cantabile. Fixes #140.
2012-01-18 02:53:30 +01:00
wm4 3041ee8d6c core: add screenshot mode for actual VO window contents
The screenshot command normally converts the currently displayed video
frame to an image. Add support for an alternative screenshot mode
that is supposed to capture the real window contents. Such a
screenshot contains a possibly scaled version of the frame, the OSD,
and subtitles.

Add a default key binding Alt+s for taking screenshots in this mode.

This needs special VO support, and might not work with all VOs (this
commit does not yet contain an implementation for any VO, only the
infrastructure).
2011-11-25 23:56:28 +02:00
wm4 01cf896a2f core: add infrastructure to get screenshots from VOs
Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot
directly from the VO. If VO support is available, screenshots will be
taken instantly (no more 1 or 2 frames delay). Taking screenshots when
hardware decoding is in use will also work (vdpau). Additionally, the
screenshots will now use the same colorspace as the video display.
Change the central MPContext to be allocated with talloc so that it
can be used as a talloc parent context.

This commit does not yet implement the functionality for any VO (added
in subsequent commits).

The old screenshot video filter is not needed anymore if VO support is
present, and in that case will not be used even if it is present in
the filter chain. If VO support is not available then the filter is
used like before. Note that the filter still has some of the old
problems, such as delaying the screenshot by at least 1 frame.
2011-11-25 23:56:28 +02:00