#define INT64_MAX 9223372036854775807LL
#endif
#define MAX_RETRY 1000
+// max pts/curr_pos drift allowed before correction (in seconds)
+#define AUDIO_PTS_TOLERANCE 0.04
#include "asset.h"
#include "bccmodels.h"
int FFAudioStream::decode_frame(AVFrame *frame)
{
int first_frame = seeked; seeked = 0;
+ frame->best_effort_timestamp = AV_NOPTS_VALUE;
int ret = avcodec_receive_frame(avctx, frame);
if( ret < 0 ) {
if( first_frame || ret == AVERROR(EAGAIN) ) return 0;
return -1;
}
int64_t pkt_ts = frame->best_effort_timestamp;
- if( pkt_ts != AV_NOPTS_VALUE )
- curr_pos = ffmpeg->to_secs(pkt_ts - nudge, st->time_base) * sample_rate + 0.5;
+ if( pkt_ts != AV_NOPTS_VALUE ) {
+ double ts = ffmpeg->to_secs(pkt_ts - nudge, st->time_base);
+ double t = (double)curr_pos / sample_rate;
+// some time_base clocks are very grainy, too grainy for audio (clicks, pops)
+ if( fabs(ts - t) > AUDIO_PTS_TOLERANCE )
+ curr_pos = ts * sample_rate + 0.5;
+ }
return 1;
}
if( pos == curr_pos ) return 0;
reset_history(); mbsz = 0;
// guarentee preload > 1sec samples
- if( seek(pos-sample_rate, sample_rate) < 0 ) return -1;
+ if( (pos-=sample_rate) < 0 ) pos = 0;
+ if( seek(pos, sample_rate) < 0 ) return -1;
return 1;
}
effect by adding moving lines and snow.
Auto Scale: Automatically scale to a specified size.
Blue Banana: Used for color transformation or remapping as
- well as chroma-key filtering. Basic usage:
+ well as chroma-key filtering. Features5 37.8 usage:
. Select a specifc target color.
. Create a selection region by expanding color.
. Optionally reduce or expand the alpha plane.
F_chromakey: Turns a certain color into
transparency. Operates on YUV colors.
F_ciescope: Video CIE scope.
+F_color: Provide an uniformly colored input.
F_colorbalance: Adjusts the color balance.
F_colorchannelmixer: Adjusts colors by mixing color channels.
F_colorkey: Turns a certain color into
F_cover_rect: Find and cover a user specified object.
F_crop: Crops the input video.
F_cropdetect: Auto-detect crop size
+F_curves: Adjust components curves.
F_datascope: Video data analysis.
+F_dctdnoiz: Denoise frames using 2D DCT.
F_deband: Debands video.
F_deflate: Applies deflate effect.
F_deflicker: Remove temporal frame luminance variations.
F_fieldorder: Set the field order.
F_fillborders: Fill borders of the input video.
F_floodfill: Fill area of the same color with another color.
+F_format: Convert the input video to one of the specified pixel formats.
F_framerate: Upsamples or downsamples progressive
source between specified frame rates.
F_fspp: Applies Fast Simple Post-processing filter.
F_lut3d: Apply a 3D LUT (look up table) to an input video.
F_lutrgb: Compute and apply a lookup table to the RGB input video.
F_lutyuv: Combine and apply a lookup table to the YUV input video.
+F_mandelbrot: Render a Mandelbrot fractal.
F_mcdeint: Applies motion compensating deinterlacing.
F_mestimate: Generate motion vectors.
F_mpdecimate: Remove near-duplicate frames.
+F_mptestsrc: Generate various test pattern.
F_negate: Negates input video.
F_nlmeans: Non-local means denoiser. An example usage is for the
recovery of VHS tapes which look bad.
F_pp7: Applies Postprocessing 7 filter.
F_prewitt: Apply prewitt operator.
F_pseudocolor: Make pseudocolored video frames.
+F_rgbtestsrc: Generate RGB test pattern.
F_readeia608: Read EIA-608 Closed Caption codes from
input video and write them to frame metadata.
F_readvitc: Reads vertical interval
most likely correspond to edges.
F_rotate: Rotates the input image.
F_sab: Applies shape adaptive blur.
+F_scale: Scale the input video size and/or convert the image format.
F_separatefields: Split input video frames into fields.
F_setrange: Force color range for the output video frame.
F_showinfo: Show textual information for each video frame.
+F_showpalette: Display frame palette.
F_shuffleframes: Shuffles video frames.
F_shuffleplanes: Shuffles video planes.
F_signalstats: Separates statistics from video analysis.
the Super2xSal pixel art algorithm.
F_swaprect: Swaps 2 rectangular objects in video.
F_swapuv: Swaps U and V components.
+F_tblend: Blend successive frames.
+F_testsrc: Generate test pattern.
+F_testsrc2: Generate another test pattern.
+F_tile: Tile several successive frames together.
F_tinterlace: Performs temporal field interlacing.
F_tlut2: Compute and apply a lookup table from 2 successive frames.
F_transpose: Transposes input video.
+F_unsharp: Sharpen or blur the input video.
F_uspp: Applies Ultra Simple/Slow Post-processing filter.
F_vaguedenoiser: Applies a Wavelet based Denoiser.
F_vectorscope: Video vectorscope.
F_weave: Weaves input video fields into frames.
F_xbr: Scales the input using xBR algorithm.
F_yadif: Deinterlaces the input image.
+F_yuvtestsrc: Generate YUV test pattern.
F_zoompan: Applies Zoom & Pan effect.
#
# Description of FFmpeg Audio Plugins
F_aemphasis: Audio emphasis.
F_aeval: Filters audio signal according to a specific expression.
F_afade: Fades in/out input audio.
+F_aformat: Convert the input audio to one of the specified formats.
F_agate: Audio gate.
+F_aiir: Apply infinite Impulse Response filter with supplied
+ coefficients.
F_allpass: Applies a two-pole all-pass filter.
F_aloop: Loops audio samples.
F_anoisesrc: Generates a noise audio signal.
F_aphaser: Adds a phasing effect to the audio.
F_arealtime: Slows down filtering to match realtime.
F_aresample: Resamples audio data.
+F_asetrate: Change the sample rate without altering the data.
F_astats: Shows time domain statistics about audio frames
F_atempo: Adjusts audio tempo.
F_atrim: Pick one continuous section from the input, drop the rest.