Anton Khirnov
26e1e80152
fftools/ffmpeg_opt: reimplement -streamid using a dictionary
...
This does not require an arbitrary limit on the number of streams.
Also, return error codes from opt_streamid() instead of aborting.
1 year ago
Anton Khirnov
ab16e324ea
fftools/ffmpeg_filter: return error codes from ofilter_bind_ost() instead of aborting
1 year ago
Anton Khirnov
c4b074676a
fftools/ffmpeg_mux_init: avoid invalid memory access in set_dispositions()
...
This function assumes AVMEDIA_* are always positive, while in fact it
can also handle AVMEDIA_TYPE_UNKNOWN, which is -1.
1 year ago
Anton Khirnov
037d364797
fftools/ffmpeg_filter: move "smart" pixfmt selection to ffmpeg_mux_init
...
This code works on encoder information and has no interaction with
filtering, so it does not belong in ffmpeg_filter.
1 year ago
Anton Khirnov
249bca763d
fftools/ffmpeg_mux_init: handle pixel format endianness
...
When -pix_fmt designates a BE/LE pixel format, it gets translated into
the native one by av_get_pix_fmt(). This may not always be the best
choice, as the encoder might only support one endianness. In such a
case, explicitly choose the endianness supported by the encoder.
While this is currently redundant with choose_pixel_fmt() in
ffmpeg_filter.c, the latter code will be deprecated in following commits.
1 year ago
Anton Khirnov
153cf85b24
fftools/ffmpeg_mux_init: fix an array declaration
...
map_func is supposed to be an array of const pointer to function
returning int, not an array of pointer to function returning const int.
Reported-By: Martin Storsjö
1 year ago
Anton Khirnov
dff3a283cd
fftools/ffmpeg: rework -enc_time_base handling
...
Read the timebase from FrameData rather than the input stream. This
should fix #10393 and generally be more reliable.
Replace the use of '-1' to indicate demuxing timebase with the string
'demux'. Also allow to request filter timebase with
'-enc_time_base filter'.
1 year ago
Anton Khirnov
20c42213ea
fftools/ffmpeg_mux_init: drop an obsolete assignment
...
This line was added in c30a4489b4
along with
AVStream.sample_aspect_ratio. However, configuring SAR for video
encoding is now done after this code (specifically in enc_open(), which
is called when the first video frame to be encoded is obtained), so this
line cannot have any meaningful effect.
1 year ago
Anton Khirnov
858b635613
fftools/ffmpeg_mux_init: replace all remaining aborts with returning error codes
...
Mainly concerns new_stream_*() and their callees.
1 year ago
Anton Khirnov
45473258ff
fftools/ffmpeg_mux_init: return error codes from metadata processing instead of aborting
1 year ago
Anton Khirnov
dd44871eb9
fftools/ffmpeg_mux_init: improve of_add_programs()
...
Replace duplicated(!) and broken* custom string parsing with
av_dict_parse_string(). Return error codes instead of aborting.
* e.g. it treats NULL returned from av_get_token() as "separator not
found", when in fact av_get_token() only returns NULL on memory
allocation failure
1 year ago
Anton Khirnov
fd40197170
fftools/ffmpeg_mux_init: return error codes from validate_enc_avopt() instead of aborting
1 year ago
Anton Khirnov
4e3557aadb
fftools/ffmpeg_mux_init: return error codes from parse_forced_key_frames() instead of aborting
1 year ago
Anton Khirnov
6691d131d8
fftools/ffmpeg_mux_init: return error codes from copy_meta() instead of aborting
1 year ago
Anton Khirnov
54cbe6f57d
fftools/ffmpeg_mux_init: return error codes from ost_add() instead of aborting
1 year ago
Anton Khirnov
38a2fc2c29
fftools/ffmpeg_mux_init: move allocation out of prologue
...
ost_add() has a very large variable declaration prologue, performing
"active" actions that can fail in there is confusing.
1 year ago
Anton Khirnov
4e366100e9
fftools/ffmpeg_mux_init: return error codes from map_*() instead of aborting
1 year ago
Anton Khirnov
eee09cdf39
fftools/ffmpeg_mux_init: improve error handling in of_add_attachments()
...
* return error codes instead of aborting
* avoid leaking the AVIOContext on failure
* check the return code of avio_read()
1 year ago
Anton Khirnov
b3eedca5e5
fftools/ffmpeg_mux_init: return errors from create_streams() instead of aborting
1 year ago
Anton Khirnov
cce294638b
fftools/ffmpeg: return errors from assert_file_overwrite() instead of aborting
1 year ago
Anton Khirnov
c313cdd70c
fftools/ffmpeg_mux_init: return errors from of_open() instead of aborting
1 year ago
Anton Khirnov
5293adb1a7
fftools/ffmpeg: attach bits_per_raw_sample information to frames
...
This way avoids encoders reaching into filters or decoders for this
information.
1 year ago
Anton Khirnov
141d11cb3c
fftools/ffmpeg_mux: make OutputStream.pkt private
...
It is no longer used outside of muxing code.
1 year ago
Anton Khirnov
93e26a4db7
fftools/ffmpeg: handle -enc_time_base -1 during stream creation
...
There is no reason to postpone it until opening the encoder. Also, abort
when the input stream is unknown, rather than disregard an explicit
request from the user.
1 year ago
Anton Khirnov
58a64e3d54
fftools/ffmpeg_mux_init: only process -enc_time_base if the stream is encoded
...
It has no effect otherwise.
1 year ago
Anton Khirnov
c8a85d1b2f
fftools/ffmpeg_mux_init: do not overwrite OutputStream.frame_rate for streamcopy
...
The values currently written into it are not used after
streamcopy_init(), so it is better to confine them to that function.
1 year ago
Anton Khirnov
57021a68d9
fftools/ffmpeg_mux: set stream duration after the timebase is certainly known
...
Stop assuming the encoder knows the muxing timebase, which does not
always have to hold (e.g. due to bitstream filters).
1 year ago
Anton Khirnov
7520cd9f07
fftools/ffmpeg_mux_init: move OutputFilter setup code to ffmpeg_filter
...
That is a more appropriate place for it.
1 year ago
Anton Khirnov
87b576135e
fftools/ffmpeg_filter: factor out binding an output stream to OutputFilter
...
While the new function is trivial for now, it will become more useful in
future commits.
1 year ago
Anton Khirnov
7ea10bfef3
fftools/ffmpeg_filter: store just the link label in OutputFilter
...
Not the entire AVFilterInOut. This is simpler.
1 year ago
Anton Khirnov
da7ae627e1
fftools/ffmpeg_filter: always pass graph description to fg_create()
...
Currently NULL would be passed for simple filtergraphs, which would
make the filter code extract the graph description from the output
stream when needed. This is unnecessarily convoluted.
1 year ago
Anton Khirnov
b56db2956b
fftools/ffmpeg: add logging for creating output streams
1 year ago
Anton Khirnov
eeb7d92ac7
fftools/ffmpeg_mux_init: merge ost_add_from_filter() to ost_add()
...
This way ost_add() knows about the complex filtergraph it is fed from,
which will become useful in future commits.
1 year ago
Anton Khirnov
e9a868e9ee
fftools/sync_queue: add debug logging
1 year ago
Anton Khirnov
6abb4a28ef
fftools/ffmpeg: add InputStream.index
...
This allows to avoid access to the underlying AVStream in many places.
1 year ago
Anton Khirnov
ec75b79fe1
fftools/ffmpeg: fail earlier on text/bitmap subtitles mismatch
...
Checking whether the user requested an unsupported conversion between
text and bitmap subtitles can be done immediately when creating the
output stream.
1 year ago
Anton Khirnov
dfa29ba955
fftools/ffmpeg: return error codes from ist_*_add()
...
Will be useful in future commits.
2 years ago
Anton Khirnov
09dd9c5f41
fftools/ffmpeg_filter: add filtergraph private data
...
Start by moving OutputStream.filtered_frame to it, which really belongs
to the filtergraph rather than the output stream.
2 years ago
Anton Khirnov
0add05bd3a
fftools/ffmpeg_mux_init: rename init_output_filter() to ost_add_from_filter()
...
The previous name is misleading, because the function does not actually
initialize any filters - it creates a new output stream and binds a
filtergraph output to it.
2 years ago
Anton Khirnov
4800b50258
fftools/ffmpeg: simplify init_output_filter()
2 years ago
Anton Khirnov
ea4c42779b
fftools/ffmpeg_mux_init: drop a redundant assignment
...
OutputFilter.format is initialized in ofilter_alloc().
2 years ago
Anton Khirnov
2104de13e9
fftools/ffmpeg: reindent after previous commit
2 years ago
Anton Khirnov
6cace17b0d
fftools/ffmpeg_mux_init: drop useless new_stream_{data,unknown}
...
Their only function is checking that encoding was not specified for
data/unknown-type streams, but the check is broken because enc_ctx will
not be created in ost_add() unless a valid encoder can be found.
Add an actually working check for all types for which encoding is not
supported in choose_encoder().
2 years ago
Anton Khirnov
ab0d2052a3
fftools/ffmpeg: remove unused function arguments
2 years ago
Anton Khirnov
ecb44ca877
fftools/ffmpeg_mux_init: drop OutputStream.filters[_script]
...
They are not needed outside of ost_get_filters(), so make them stack
variables there.
2 years ago
Anton Khirnov
84e1e0fa73
fftools/ffmpeg_mux_init: move check for mixing simple/complex filters
...
Do it in ost_get_filters() together with other similar checks. Will be
useful in following commits.
Also, improve the log message.
2 years ago
Anton Khirnov
0fe5eaf69d
fftools/ffmpeg_mux_init: consolidate handling -filter for audio/video
2 years ago
Anton Khirnov
30699c103f
fftools/ffmpeg_mux: make copy_initial_nonkeyframes private to muxing code
...
It is no longer used outside of ffmpeg_mux*
2 years ago
Anton Khirnov
7f8827f28e
fftools/ffmpeg_mux: make copy_prior_start private to muxing code
...
It is no longer used outside of ffmpeg_mux*
2 years ago
Anton Khirnov
83646146fe
fftools/ffmpeg_mux: make ts_copy_start private to muxing code
...
It is no longer used outside of ffmpeg_mux*
2 years ago