![如何使用 setpts 过滤器设置开始](https://linux22.com/image/1555655/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20setpts%20%E8%BF%87%E6%BB%A4%E5%99%A8%E8%AE%BE%E7%BD%AE%E5%BC%80%E5%A7%8B.png)
我想将流起始设置为 0,但输入的 TS 文件不是起始 0。然后我使用 setpts 过滤器手动设置起始。如何使用 setpts 过滤器设置选项?
ffprobe -loglevel quiet -select_streams 0:v -show_entries stream=start_time -of compact=p=0:nk=1 "F:\TS\input.ts" -v 0
72532.961778
and set 72532.961778 manually
ffplay -i "F:\TS\input.ts" -vf "setpts=PTS-72532.961778/TB,showinfo"
ffplay version N-90288-g2536bd8632 Copyright (c) 2003-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 9.100 / 56. 9.100
libavcodec 58. 14.100 / 58. 14.100
libavformat 58. 10.100 / 58. 10.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 12.100 / 7. 12.100
libswscale 5. 0.102 / 5. 0.102
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
[aac @ 000000000039a680] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 000000000039a680] decode_pce: Input buffer exhausted before END element found
[aac @ 000000000039a680] This stream seems to incorrectly report its last channel as LFE[5], mapping to LFE[0]
[mpegts @ 00000000003950c0] start time for stream 3 is not set in estimate_timings_from_pts
[mpegts @ 00000000003950c0] PES packet size mismatch
[mpegts @ 00000000003950c0] Could not find codec parameters for stream 4 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 00000000003950c0] Could not find codec parameters for stream 5 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'F:\TS\input.ts':
Duration: 02:09:52.24, start: 72532.442700, bitrate: 20025 kb/s
Stream #0:0[0x340]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x341]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 5.1, fltp, 384 kb/s
Stream #0:2[0x345]: Data: bin_data ([6][0][0][0] / 0x0006)
Stream #0:3[0x146]: Data: bin_data ([6][0][0][0] / 0x0006)
Stream #0:4[0x350]: Unknown: none ([13][0][0][0] / 0x000D)
Stream #0:5[0x351]: Unknown: none ([13][0][0][0] / 0x000D)0/0
SDL_OpenAudio (6 channels, 48000 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (4 channels, 48000 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (2 channels, 48000 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (1 channels, 48000 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (6 channels, 44100 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (4 channels, 44100 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (2 channels, 44100 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
SDL_OpenAudio (1 channels, 44100 Hz): WASAPI can't initialize audio client: CoInitialize 縺ッ蜻シ縺ウ蜃コ縺輔l縺ヲ縺・∪縺帙s縲・
No more combinations to try, audio open failed
[Parsed_showinfo_1 @ 0000000000414ec0] config in time_base: 1/90000, frame_rate: 30000/1001
[Parsed_showinfo_1 @ 0000000000414ec0] config out time_base: 0/0, frame_rate: 0/0
[Parsed_showinfo_1 @ 0000000000414ec0] n: 0 pts: 46717 pts_time:0.519078 pos: 2820 fmt:yuv420p sar:1/1 s:1920x1080 i:T iskey:1 type:I checksum:A6F29BB6 plane_checksum:[3AA1876F 95213FFD 47AED43B] mean:[20 128 128] stdev:[29.9 2.0 0.4]
[Parsed_showinfo_1 @ 0000000000414ec0] side data - pan/scan
[Parsed_showinfo_1 @ 0000000000414ec0] side data - unknown side data type 12 (8 bytes)
[Parsed_showinfo_1 @ 0000000000414ec0] n: 1 pts: 49720 pts_time:0.552444 pos: 139684 fmt:yuv420p sar:1/1 s:1920x1080 i:T iskey:0 type:B checksum:E97B5BBE plane_checksum:[8A5F48B4 8C593FA0 A2FDD35B] mean:[20 128 128] stdev:[29.8 2.0 0.4]
答案1
格式 start_time != stream start_time
获得价值
ffprobe -loglevel quiet -select_streams 0:v -show_entries stream=start_time -of compact=p=0:nk=1 "F:\TS\input.ts" -v 0