Commit Graph

475 Commits

Author SHA1 Message Date
Andreas Rheinhardt c6134ce65f fftools/ffprobe: Improve description of AFD side data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-09 20:21:31 +02:00
Andreas Rheinhardt dc977f94d5 fftools/ffprobe: Add const to AVPacket data pointers
These packets need not be writable (and are not modified by us),
so it is best to access them via const uint8_t*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-09 19:37:53 +02:00
Nicolas Gaullier d3cf7be5a4 fftools: Fix preset search pathes
regression since 13350e81fd

Fix looking for .ffmpeg subfolder in FFMPEG_DATADIR and inversely not in HOME.
Fix search order (documentation).

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2022-07-08 13:58:49 +02:00
Marton Balint 20e2aa940c fftools/ffmpeg: change frame counters to 64 bit
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we are always
using 64 bit values for them.

A live stream can easily run for more than a year and the framedup logic breaks
on an overflow.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-27 20:37:43 +02:00
Niklas Haas a526f0cc3a fftools/ffplay: fix YUV conversion mode
GL and Metal cache the state at time of texture creation. GLES2 and
Direct3D 11 use the state at time of the render copy call.

So the only way we can get the correct behavior consistently is by
making sure the state is set for both the upload *and* the draw call.
This probably isn't our bug to fix (upstream should make itself behave
consistently and also document its functions), but as it stands,
`ffplay` is misrendering BT.709 as BT.601 on my stock Linux system, and
that leaves a bad taste in my mouth.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-06-27 12:17:59 +02:00
Nil Admirari 13350e81fd fftools: Remove MAX_PATH limit and switch to UTF-8 versions of fopen() and getenv()
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-21 13:27:46 +03:00
Marton Balint c11fb46731 fftools/ffprobe: report avio errors
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-20 23:51:54 +02:00
softworkz fee765c207 fftools/fopen_utf8: support long paths on Windows for fftools
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-06-19 01:38:23 +03:00
Stefano Sabatini ff07492cd8 ffprobe: add -o option
This enables printing to a resource specified with -o OUTPUT.

In case the output is not specified, prints to stdout as usual.

Address issue: http://trac.ffmpeg.org/ticket/8024

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-13 22:42:55 +02:00
Gyan Doshi 09c53a04c5 ffmpeg: add option fps_mode
fps_mode sets video sync per output stream. Overrides vsync for matching
streams.

vsync is deprecated.
2022-06-11 09:47:27 +05:30
Stefano Sabatini 605b4016b3 ffmpeg: drop undocumented -d option
Option was added in commit 39aafa5ee9 but was never documented.

Also does not seem there are current use cases for it,
tests for which it was introduced are still working therefore we drop
it altogether.

Indirectly fix trac issue: http://trac.ffmpeg.org/ticket/1698

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-09 21:12:16 +02:00
Stefano Sabatini 7adeeff91f ffprobe: update entry index after printing packet/media type
Fix JSON output in case a frame or packet section contains a nested section.

Fix trac issue http://trac.ffmpeg.org/ticket/8680.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-06-09 00:10:17 +02:00
Anton Khirnov b033913d1c fftools/ffmpeg: move processing AV_PKT_DATA_QUALITY_STATS to do_video_stats()
This is a more appropriate place for this code, since the values we read
from AV_PKT_DATA_QUALITY_STATS side data are primarily written into
video stats. This ensures that the values written into stats actually
apply to the right packet.

Rename the function to update_video_stats() to better reflect its new
purpose.
2022-05-24 13:46:57 +02:00
Anton Khirnov 0c914ebd53 fftools/ffmpeg: merge variable declaration and initialization 2022-05-24 13:46:57 +02:00
Anton Khirnov 9acce2afcf fftools/ffmpeg: stop using av_stream_get_end_pts() in do_video_stats()
It retrieves libavformat's internal dts value (contrary to the
function's name), which is not only incorrect in general, but also
unnecessary because we can access the packet directly.
2022-05-24 13:46:57 +02:00
Anton Khirnov 3d4d355375 fftools/ffmpeg: stop using AVStream.nb_frames in do_video_stats()
Its use for muxing is not documented, in practice it is incremented per
each packet successfully passed to the muxer's write_packet(). Since
there is a lot of indirection between ffmpeg receiving a packet from the
encoder and it actually being written (e.g. bitstream filters, the
interleaving queue), using nb_frames here is incorrect.

Add a new counter for packets received from encoder instead.
2022-05-24 13:46:57 +02:00
Anton Khirnov 19d1e1fb06 fftools/ffmpeg: move do_video_stats() to avoid a forward declaration 2022-05-24 13:46:57 +02:00
Anton Khirnov 1753fbd095 fftools/ffmpeg: drop a useless check and reduce indentation
do_video_stats() is only ever called for video.
2022-05-24 13:46:57 +02:00
Anton Khirnov 9f4437a4eb fftools/ffmpeg: reindent after previous commit 2022-05-24 13:46:57 +02:00
Anton Khirnov 2ecb333fe4 fftools/ffmpeg: reuse the encoding code for flushing encoders 2022-05-24 13:46:57 +02:00
Anton Khirnov a11ab64730 fftools/ffmpeg: share the code encoding a single frame between video and audio
Call do_video_stats() for every video packet produced by the encoder,
rather than for every frame sent to the encoder.
2022-05-24 13:46:57 +02:00
Anton Khirnov e53940186a fftools/ffmpeg: fix 2pass log file names
Use the global stream index rather than an unrelated variable in the
filename.

Broken in 6d5d924604.
2022-05-24 13:35:16 +02:00
Martin Storsjö 4cdc14aa95 libavutil: Deprecate av_fopen_utf8, provide an avpriv version
Since every DLL can use an individual CRT on Windows, having
an exported function that opens a FILE* won't work if that
FILE* is going to be used from a different DLL (or from user
application code).

Internally within the libraries, the issue can be worked around
by duplicating the function in all libraries (this already happened
implicitly because the function resided in file_open.c) and renaming
the function to ff_fopen_utf8 (so that it doesn't end up exported from
the DLLs) and duplicating it in all libraries that use it.

This makes the avpriv_fopen_utf8 / ff_fopen_utf8 function work in
the exact same way as the existing avpriv_open / ff_open, with the
same setup as introduced in e743e7ae6e.

That mechanism doesn't work for external users, thus deprecate the
existing function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:52:26 +03:00
Martin Storsjö 3fb9244642 fftools: Stop using av_fopen_utf8
Provide a header based inline reimplementation of it.

Using av_fopen_utf8 doesn't work outside of the libraries when built
with MSVC as shared libraries (in the default configuration, where
each DLL gets a separate statically linked CRT).

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:35:59 +03:00
Gyan Doshi 9ab20b1614 opt_common: note D and T type streams for completeness.
Addresses #9784
2022-05-20 23:42:23 +05:30
softworkz b8ede4d637 fftools/opt_common: add includes of avf headers for clarity
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-18 18:01:51 +02:00
Stefano Sabatini 83e1a1de88 doc/ffprobe: clarify that the input file is not optional
Fix trac issue http://trac.ffmpeg.org/ticket/9562
2022-04-21 12:34:04 +05:30
Anton Khirnov 4a7c8bb3d8 fftools/ffmpeg: store output format separately from the muxer context
Allows accessing it without going through the muxer context. This will
be useful in the following commits, where the muxer context will be
hidden.
2022-04-13 12:07:54 +02:00
Anton Khirnov 5c66ee6351 fftools/ffmpeg: move freeing the output file to ffmpeg_mux.c 2022-04-13 12:07:54 +02:00
Anton Khirnov 5bc644ea8a fftools/ffmpeg: move writing the trailer to ffmpeg_mux.c 2022-04-13 12:07:54 +02:00
Anton Khirnov 288aa37387 fftools/ffmpeg: move some muxing-related code into a separate file
This is a first step towards making muxers more independent from the
rest of the code.
2022-04-13 12:07:54 +02:00
Anton Khirnov b1a984cb49 fftools/ffmpeg: store the output file index in OutputFile
Use it to simplify check_init_output_file(). Will allow further
simplifications in the following commits.
2022-04-13 12:07:54 +02:00
Anton Khirnov 16aea9a38b fftools/ffmpeg: pass the muxer context explicitly to some functions
Stop accessing OutputFile.ctx. This will be useful in the following
commits, where it will become hidden.
2022-04-13 12:07:54 +02:00
Anton Khirnov 662364b2ef fftools/ffmpeg: stop using OutputStream.frame_number for streamcopy
This field is currently used by checks
- skipping packets before the first keyframe
- skipping packets before start time
to test whether any packets have been output already. But since
frame_number is incremented after the bitstream filters are applied
(which may involve delay), this use is incorrect. The keyframe check
works around this by adding an extra flag, the start-time check does
not.

Simplify both checks by replacing the seen_kf flag with a flag tracking
whether any packets have been output by do_streamcopy().
2022-04-13 12:07:54 +02:00
Anton Khirnov 86e1c0303c fftools/ffmpeg: move a comment to a more appropriate place 2022-04-13 12:07:54 +02:00
Anton Khirnov a8c95e1feb fftools/ffmpeg: drop an obsolete hack
Introduced in 05741d70c7. All encoders should set the timestamps
properly now, so it should never be necessary.
2022-04-13 12:07:54 +02:00
James Almer b04f14136e fftools/opt_cmdutils: fix printing known channel layouts
Look for the generic "USR" labels instead of "?" to skip channels with no
known names, and actually print the decomposition of standard channel layouts.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-25 08:42:45 -03:00
Jaakko Perttilä b1cbeabf5e ffmpeg: add packet duration to AVPacket logging
Especially useful when debugging subtitle output, but also shows
if values are set or not for demux and encoding.

Co-authored-by: Jan Ekström <jan.ekstrom@24i.com>

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2022-03-23 17:26:20 +02:00
Anton Khirnov 1728ad8293 fftools/cmdutils: drop redundant code
It allocates a dummy sws/swr context and tries setting options on it,
apparently to check if they are valid. This is redundant, since the
options will be checked if/when they are later applied on a context that
is actually used for conversion.
2022-03-22 18:49:43 +01:00
Anton Khirnov bd0cbebf3e fftools: drop the fake "default" option from ffplay/ffprobe
It tries to process any unhandled options as AVOptions. Handle this
directly in cmdutils.c, without resorting to a confusing fake option
definition (which is currently visible to the users in -help output).
2022-03-22 18:49:43 +01:00
Anton Khirnov 1dd6363581 fftools/ffprobe: drop -show_format_entry
Deprecated since 2012.
2022-03-22 18:49:43 +01:00
Anton Khirnov 6fd1cd6053 fftools/ffplay: drop options deprecated since 2011 2022-03-22 18:49:43 +01:00
Anton Khirnov 8d293918b5 fftools/ffmpeg: drop mistakenly added empty line 2022-03-22 18:49:43 +01:00
Anton Khirnov 00da464658 fftools: move opt_timelimit from cmdutils to ffmpeg
This option is only supported by ffmpeg.
2022-03-22 18:49:43 +01:00
Anton Khirnov a545cb2b9d fftools/cmdutils: split common option handlers into their own file 2022-03-22 18:49:43 +01:00
Anton Khirnov c99b93c5d5 fftools: drop useless indirection 2022-03-22 18:49:43 +01:00
Anton Khirnov 5e51f5af33 fftools/cmdutils: drop extern declarations for nonexistent variables 2022-03-22 18:49:43 +01:00
Anton Khirnov e46d8c53a3 fftools/cmdutils: drop prototypes for nonexistent functions 2022-03-22 18:49:43 +01:00
James Almer e78173557d ffmpeg: make the ac option set the demuxer's ch_layout AVOption
channels is deprecated on all supported raw demuxers.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:39 -03:00
James Almer 639c2f0049 ffmpeg: add a ch_layout option as an alias to channel_layout
This ensures it's parsed as a CLI option instead of the AVCodecContext AVOption.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00