Prevent FFmpeg from consuming stdin and interpreting the character
stream as a stream of interactive commands, specifically:
? show this help
+ increase verbosity
- decrease verbosity
c Send command to first matching filter supporting it
C Send/Queue command to all matching filters
D cycle through available debug modes
h dump packets/hex press to cycle through the 3 states
q quit
s Show QP histogram
This prevents misclicking a key or key sequence (e.g., h) produces a
large amount of debugging output which may confuse the unseasoned
user. It is also useful in a batch environment where an unsuspecting
user may not realize you-get could consume stdin through FFmpeg, e.g.
while read url; do you-get $url; done <urllist
(Related: BashFAQ/089.)
Note that interactive commands are enabled in debug mode (which also
doesn't suppress FFmpeg's default logging).
---
A note on implementation:
An alternative would be FFmpeg's -nostdin option, which explicitly
disables interaction, but adding such an option to existing code would
be even more destructive than the stdin=DEVNULL approach taken here.
---
This commit also happens to fix a dual-call bug in
ffmpeg_concat_mp4_to_mpg.
This is a follow-up to #999.
This commit adds the
<function_name>: <url>
debug message, which was previously only emitted by get_content and
post_content, to all high level utility functions with network requests
except url_size, url_save and url_save_chunked (in order not to ruin
progress bars).
Occasionally, the FFmpeg invocation fails (which could be due to bugs in
you-get; see #1558 for instance), but -loglevel quiet means nothing is
printed other than the exit status (pretty much always 1) in Python's
traceback, which is not helpful at all.
This commit restores FFmpeg's regular output (-loglevel info) when
--debug is specified. We're not using verbose, debug or trace because
those levels are mostly only useful for debugging FFmpeg itself, which
is not our goal.
Due to lack of meaningful API to access the global logging level, this
is a hack based on two assumptions:
1. When --debug is enabled, the root logger level is set to DEBUG;
2. processor.ffmpeg is lazily imported, after command line options are
parsed.
Relative paths in the concat list are considered relative to the parent
directory of the script, not the calling directory. This isn't entirely
obvious from the documentation, but it is easy to infer from the concat
demuxer's concept of "safety", and easy to test (confirmed on FFmpeg
3.2.2). See https://ffmpeg.org/ffmpeg-all.html#concat-1 for details.
This commit fixes the wrong relative paths when --output-dir is
specified and not pwd.
This commit also
- Factors out common concat list writer code;
- Slightly simplifies the code to collect FFmpeg params (on Py35+ we can
further simplify by unpacking LOGLEVEL with the star operator right in
the list literal).