summaryrefslogtreecommitdiff
path: root/fftools
Commit message (Collapse)AuthorAge
* ffmpeg: take into account image flipping in the display matrixJames Almer2021-09-16
| | | | | | | This covers only standard rotations. Fixes part of ticket #6945. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: use display matrix frame side data for autorotationJames Almer2021-09-16
| | | | | | | And give it priority over stream side data when present. Fixes part of ticket #6945. Signed-off-by: James Almer <jamrial@gmail.com>
* cmdutils: round rotation value to nearest integerJames Almer2021-09-16
| | | | | | As recommended by the doxy for av_display_rotation_get(). Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffprobe: Don't access AVProgram.(start|end)_timeAndreas Rheinhardt2021-09-14
| | | | | | | These are internal fields. Reviewed-by: Tobias Rapp <t.rapp@noa-archive.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg_hw: make hardware selection for filters more user friendlyHaihao Xiang2021-09-12
| | | | | | | | | | | | | | | | When a device is derived from a source device, there are at least 2 devices, and usually the derived device is the expected device, so let's pick the last device if user doesn't specify the filter device with filter_hw_device option After applying this patch, the command below can work: $> ffmpeg -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device qsv=hw@va -f lavfi -i yuvtestsrc -vf format=nv12,hwupload=extra_hw_frames=64 -c:v h264_qsv -y out.h264 Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Use %c, not %s to write a single charAndreas Rheinhardt2021-09-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "ffmpeg: force 128k default audio bitrate if nothing is specified and ↵Andreas Rheinhardt2021-09-05
| | | | | | | | | | | | | | | | | | | | | | | | there is no specific default" This reverts commit 628a73f8f3768513fa6152c98d54842cf2ae1aad. At the time of said commit there was talk of removing the audio bitrate "ab" option to bring FFmpeg in line with what Libav has done in 2012 in commit 041cd5a0c55e02dd3b9a2419644b03103819c3d3. By having different option flags for the "ab" and the ordinay bitrate "b" option is is possible to have different default bitrates for audio and video. In order to maintain this behaviour and not break user scripts the commit to be reverted added code to ffmpeg.c that set the bitrate value to the audio default for audio codecs, but only if AVCodec.defaults didn't exist (as in this case the default would be codec-default and not affected by the "ab" removal). This had the downside of being an API violation, because AVCodec.defaults is not a public field. Given that the "ab" option and its audio-specific default value have never been removed, said API violation can be simply fixed by reverting said commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: let AVFilterGraph parse the filter_threads optionJames Almer2021-09-04
| | | | | | | | | This way the CLI accepts for "filter_threads" the same values as for the libavcodec specific option "threads". Fixes FATE with THREADS=auto which was broken in bdc1bdf3f5. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Use %c, not %s, to write single charAndreas Rheinhardt2021-09-04
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Don't access AV(In|Out)putformat.get_device_listAndreas Rheinhardt2021-09-04
| | | | | | It is not part of the public API. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: Remove unused fieldsAndreas Rheinhardt2021-09-03
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: Remove remnants of resample_optsAndreas Rheinhardt2021-09-03
| | | | | | | | | | | | | | These were intended to pass options to auto-inserted avresample resampling filters. Yet FFmpeg uses swresample for this purpose (with its own AVDictionary swr_opts similar to resample_opts). Therefore said options were not forwarded any more since commit 911417f0b34e611bf084319c5b5a4e4e630da940; moreover since commit 420cedd49745b284c35d97b936b71ff79b43bdf7 avresample options are not even recognized and ignored any more. Yet there are still remnants of all of this. This commit gets rid of them. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Fix warning for initialization makes integer from pointer ↵Limin Wang2021-09-01
| | | | | | without a cast Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* Revert "fftools/ffmpeg_filter: fix the flags parsing for scaler"Linjie Fu2021-08-30
| | | | | | | | | This reverts commit b3a0548a981db52911dd34d9de254c4fee0a8f79. This breaks the usage of swscale options, scale_sws_opts should be passed to auto-inserted scale-filters. Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* ffmpeg_filter: do not override -filter_threads with -threadsAnton Khirnov2021-08-29
| | | | | | | When both -filter_threads and -threads are specified, the latter takes effect. Since -threads is an encoder option and -filter_threads is a filter option, it makes sense for the -filter_threads to take precedence.
* ffmpeg: reset the dict iterator before useAnton Khirnov2021-08-29
|
* fftools/ffmpeg_filter: silence valgrind warningPaul B Mahol2021-08-25
|
* avcodec: add a Film Grain codec property flagJames Almer2021-08-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Switch to avfilter_filter_pad_count()Andreas Rheinhardt2021-08-20
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Use avfilter_pad_count() for AVFilter's number of padsAndreas Rheinhardt2021-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | Besides being nicer code this also has the advantage of not making assumptions about the internal implementation: While it is documented that the AVFilter.inputs and AVFilter.outputs arrays are terminated by a zeroed sentinel, one is not allowed to infer that one can just check avfilter_pad_get_name(padarray, i) to see whether one has reached the sentinel: It could be that the pointer to the string is contained in a different structure than AVFilterPad that needs to be accessed first: return pad->struct->string. It could be that for small strings an internal buffer in AVFilterPad is used (to avoid a relocation) whereas for longer strings an external string is used; this is useful to avoid relocations: return pad->string_ptr ? pad->string_ptr : pad->interal_string Or it could be that the name has a default value: return pad->name ? pad->name : "default" (This actually made sense for us because the name of most of our AVFilterPads is just "default"; doing so would save lots of relocations.) The only thing one is allowed to infer from the existence of the sentinel is that one is allowed to use avfilter_pad_count() to get the number of pads. Therefore it is used. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg_hw: Don't ignore key parameters when initializing a hw deviceHaihao Xiang2021-08-17
| | | | | | | | | | Currently user may use '-init_hw_device type=name' to initialize a hw device, however the key parameter is ignored when use '-init_hw_device type=name,key=value'. After applying this patch, user may set key parameter if needed. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* qsvdec: add support for HW_DEVICE_CTX methodHaihao Xiang2021-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows user set hw_device_ctx instead of hw_frames_ctx for QSV decoders, hence we may remove the ad-hoc libmfx setup code from FFmpeg. "-hwaccel_output_format format" is applied to QSV decoders after removing the ad-hoc libmfx code. In order to keep compatibility with old commandlines, the default format is set to AV_PIX_FMT_QSV, but this behavior will be removed in the future. Please set "-hwaccel_output_format qsv" explicitly if AV_PIX_FMT_QSV is expected. The normal device stuff works for QSV decoders now, user may use "-init_hw_device args" to initialise device and "-hwaccel_device devicename" to select a device for QSV decoders. "-qsv_device device" which was added for workarounding device selection in the ad-hoc libmfx code still works For example: $> ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=/dev/dri/card0 -hwaccel qsv -c:v h264_qsv -i input.h264 -f null - /dev/dri/renderD128 is actually open for h264_qsv decoder in the above command without this patch. After applying this patch, /dev/dri/card0 is used. $> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device qsv=hw@va -hwaccel_device hw -hwaccel qsv -c:v h264_qsv -i input.h264 -f null - device hw of type qsv is not usable in the above command without this patch. After applying this patch, this command works as expected. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/cmdutils: Use av_strstart() instead of strncmp()Andreas Rheinhardt2021-08-11
| | | | | | This also avoids hardcoding lengths. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/cmdutils: Remove unused cpu_countAndreas Rheinhardt2021-08-08
| | | | | | Added in cf12a478b206cd107343827426a05aedb83816bc, but not used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffprobe: remove references to frame->pkt_ptsJames Almer2021-08-07
| | | | | | The field was removed during the last major bump. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_filter: add a return at the end of non-void functionsJames Almer2021-08-06
| | | | | | Fixes compilation with GCC 11 when configured with --disable-optimizations Signed-off-by: James Almer <jamrial@gmail.com>
* ffprobe: Rename Audio Service Type 'type' field to 'service_type'Derek Buitenhuis2021-08-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 677a030b26045acb50353d7954ae984ceefcd807 introduced more printable side data types in ffprobe, however the Audio Service Type side data 'type' field that was introduced aliases an existing field of the same name within the side data array, which can lead to JSON output like: "side_data_list": [ { "side_data_type": "Audio Service Type", "type": 0 }, { "side_data_type": "Stereo 3D", "type": "side by side", "inverted": 1 } ] This, while technically valid JSON, is considered bad practice, since it forces all downstream users to manually parse it and check all types; it makes simple deserialization impossible. Worse, in som loosely type languages, it can lead to silent bugs if exising code assumed it was a different type. As such, rename this second "type" field to "service_type". Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* fftools/ffmpeg_filter: fix the flags parsing for scalerLinjie Fu2021-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Scaler relys on "-sws_flags" option to pass the flags to swscale and scale filter. Currently passing "sws_flags=xxx" as a filter option to scaler leads to an incorrect option parsing. Check and change the string to "flags=xxx" and dumped flags information. (Refer to parse_sws_flags()) CMD: $ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd \ -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 - Before: [auto_scaler_0 @ 0x7f96c3808680] w:iw h:ih flags:'' interl:0 [auto_scaler_0 @ 0x7f96c3808680] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x0 [Parsed_scale_1 @ 0x7f96c3806e40] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x0 MD5=ff1d6091690c6fcd36d458d2a9f648ce After: [auto_scaler_0 @ 0x7fe94563b4c0] w:iw h:ih flags:'lanczos+bitexact+accurate_rnd' interl:0 [auto_scaler_0 @ 0x7fe94563b4c0] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200 [Parsed_scale_1 @ 0x7fe945639d00] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200 MD5=ff1d6091690c6fcd36d458d2a9f648ce Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* fftools: Don't set default swscale flags in ffmpeg/ffprobe/ffplayLinjie Fu2021-08-05
| | | | Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* ffmpeg_opt: restore documented stream selection behaviourGyan Doshi2021-08-01
| | | | | | | | | | | | | | | | 11d3b03fcb added consideration of default stream disposition for audio and video when choosing the 'best' stream among all the inputs. This can lead to video streams with lower resolution or audio streams with fewer channels being selected. Stream disposition, however, only sets a priority for a stream among all other streams in the *same input*. It cannot set a priority for a stream across all inputs. This patch sets a middle-way and selects the best stream from each file with default disposition considered. Then it discards disposition weight and selects best stream as per the original criteria of highest resolution for video and most channels for audio.
* ffmpeg: fix order between field order autodetection and overrideJan Ekström2021-07-25
| | | | | | | | | | | | | | | | Having the override before autodetection meant that the overridden value got overwritten by the autodetected result each time, effectively disabling the ability to utilize the `-top` option for override purposes. Somehow I missed this in fbb44bc51a647862eb05ae3f9d7d49a0be9bed57 , even though the lines were within the context. Probably the code originally being after this logic had something to do with it, but previously it only touched the avformat context's codecpar, which did not affect the encoder codec context whatsoever. Fixes #9320 Fixes #9339
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary mem.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including bsf.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include bsf.h directly wherever it is used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/cpu: Use av_cpu_ prefixThilo Borgmann2021-07-20
|
* fftools/ffmpeg: Fix runlength for strncmp()Thilo Borgmann2021-07-19
|
* ffmpeg: delay readrate enforcement for decoded streamsGyan Doshi2021-07-19
| | | | | | | Read rate enforcement delayed till first decoded frame is obtained, to speed up init of output streams. Thanks to Linjie Fu <linjie.justin.fu@gmail.com> for the initial patch.
* fftools/ffmpeg: Fix declaration-after-statement warningAndreas Rheinhardt2021-07-18
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: fix -t inaccurate recording timeShiwang.Xie2021-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if input start time is not 0 -t is inaccurate doing stream copy, will record extra duration according to input start time. it should base on following cases: input video start time from 60s, duration is 300s, 1. stream copy: ffmpeg -ss 40 -t 60 -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 100 and set ts_offset to -100, process_input() will offset pkt->pts with ts_offset to make it 0, so when do_streamcopy() with -t, exits when ist->pts >= recording_time. 2. stream copy with -copyts: ffmpeg -ss 40 -t 60 -copyts -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 100 and set ts_offset to 0, process_input() will keep raw pkt->pts as ts_offset is 0, so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time+f->ctx->start_time). 3. stream copy with -copyts -start_at_zero: ffmpeg -ss 40 -t 60 -copyts -start_at_zero -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 120 and set ts_offset to -60 as start_to_zero option, process_input() will offset pkt->pts with input file start time, so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time). 0 60 40 60 360 |_______|_____|_______|_______________________| start -ss -t This fixes ticket #9141. Signed-off-by: Shiwang.Xie <shiwang.xie666@outlook.com>
* ffmpeg: add option readrateGyan Doshi2021-07-17
| | | | | | | Allows to read inputs at arbitrary rates. -re is equivalent to -readrate 1 Tested with -copyts {+ start_at_zero}, -ss, streamcopied & decoded streams.
* fftools/cmdutils.c: Add cmd line option to override detection of cpu count.Thilo Borgmann2021-07-16
|
* fftools/ffmpeg: Add new variant source_no_drop to the force_key_frames optionKeyun Tong2021-07-16
| | | | Suggested-By: ffmpeg@fb.com
* ffprobe: use quotation marks in the xml header outputJames Almer2021-07-15
| | | | | | | | xmllint (silently) replaces the ' with " when fixing and validating the output of ffprobe in fate-ffprobe_xsd. Reviewed-by: Tobias Rapp <t.rapp@noa-archive.com> Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: add option recast_mediaGyan Doshi2021-07-11
| | | | | Allows forcing decoders of different media type. Needed to decode media data muxed as data streams.
* ffmpeg: silence a thread_safe_callbacks deprecation warningJames Almer2021-06-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg_videotoolbox: skip memory copy if hwaccel_output_format matchzhilizhao2021-06-10
| | | | | | | | | | | | | | | | | | | | | Simple test results: Command: ./ffmpeg -y -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld \ -i test.mp4 -an -c:v h264_videotoolbox -benchmark out.mp4 Before: frame= 1221 fps= 66 q=-0.0 Lsize= 3144kB time=00:00:20.33 bitrate=1266.6kbits/s dup=4 drop=0 speed= 1.1x bench: utime=2.714s stime=1.218s rtime=18.574s After: frame= 1221 fps=137 q=-0.0 Lsize= 3144kB time=00:00:20.33 bitrate=1266.4kbits/s dup=4 drop=0 speed=2.28x bench: utime=1.450s stime=1.440s rtime=8.924s It has limited usecase since there is no video filter support, so a log message is added to notify the user. Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
* fftools/ffplay: 240M matrix is not the same as BT.601Valerii Zapodovnikov2021-06-08
| | | | | Signed-off-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* fftools/ffprobe: Remove redundant check before avcodec_free_context()Andreas Rheinhardt2021-06-08
| | | | | | | | Besides being unnecessary it is also safer: If the error for an unrecognized option were triggered (which seems to be impossible right now), it might be that the stream whose codecpar is accessed is NULL. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: remove usage of internal timestamp AVStream fieldsJames Almer2021-06-04
| | | | | | They should not be accessed outside of libavformat. Signed-off-by: James Almer <jamrial@gmail.com>