我习惯录制非高清电视节目,使用 DGIndex 转换生成的 ts 文件并继续删除广告、转码为 mp4,...
现在我录制了一个 1080p 的电视节目。由于 DGIndex 无法在这些节目上工作,并且 DGAVCIndex 的 DLL DGAVCDecode.dll 会导致大量阻塞,所以我需要找到一种新方法来做这件事。我很好奇的是 DGIndex/DGAVCIndex 如何检测音频延迟。我以为 ffmpeg 更复杂,在那里看到它应该不成问题,但我看不到。
这是 ffmpeg 的输出:
V:\>ffmpeg -i "20130327 0108.ts"
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] non-existing PPS referenced
[h264 @ 0255cfe0] non-existing PPS 0 referenced
[h264 @ 0255cfe0] decode_slice_header error
[h264 @ 0255cfe0] no frame!
[h264 @ 0255cfe0] mmco: unref short failure
Last message repeated 5 times
[mpegts @ 025597e0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[NULL @ 03f019a0] start time is not set in estimate_timings_from_pts
[mpegts @ 025597e0] PES packet size mismatch
Last message repeated 2 times
Input #0, mpegts, from '20130327 0108.ts':
Duration: 01:51:59.74, start: 12467.588567, bitrate: 9273 kb/s
Program 105
Program 106
Stream #0:0[0x20](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream #0:1[0x1ff]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:2[0x203](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 384 kb/s (clean effects)
Stream #0:3[0x204](eng): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 384 kb/s (clean effects)
Program 107
Program 108
Program 242
Program 3997
Program 3998
Program 4017
Program 4028
Program 4035
At least one output file must be specified
V:\>
注意:尽管有 h264 行,视频仍可播放。
在将 VirtualDub 的帧服务、AviSynth 和 ffmpeg 放在视频上后,我的眼睛和耳朵告诉我,根据 VLC,在生成的文件中,音频大约偏离了 -350ms。换句话说,我认为我可以在 ffmpeg 的输出中找到一些可以让我找到这 350ms 的东西。
我还使用了 ffmpeg 的开关-debug_ts
并得到如下行:
demuxer -> ist_index:1 type:video next_dts:NOPTS next_dts_time:NOPTS next_pts:NOPTS next_pts_time:NOPTS pkt_pts:1122126141 pkt_pts_time:12468.1 pkt_dts:1122122541 pkt_dts_time:12468 off:-12467588567 off_time:-12467.6
demuxer+ffmpeg -> ist_index:1 type:video pkt_pts:42135 pkt_pts_time:0.468167 pkt_dts:38535 pkt_dts_time:0.428167 off:-12467600067 off_time:-12467.6
demuxer -> ist_index:1 type:video next_dts:448167 next_dts_time:0.448167 next_pts:0 next_pts_time:0 pkt_pts:1122127941 pkt_pts_time:12468.1 pkt_dts:1122124341 pkt_dts_time:12468 off:-12467600067 off_time:-12467.6
demuxer+ffmpeg -> ist_index:1 type:video pkt_pts:43935 pkt_pts_time:0.488167 pkt_dts:40335 pkt_dts_time:0.448167 off:-12467600067 off_time:-12467.6
使用 ffmpeg-fdebug ts
我得到如下行:
first_dts 1122082971 not matching first dts 1122097371
first_dts 1122084006 not matching first dts 1122098406
first_dts 1122082971 not matching first dts 1122111771
first_dts 1122084006 not matching first dts 1122112806
first_dts 1122082971 not matching first dts 1122126171
first_dts 1122084006 not matching first dts 1122127206
我能得到的唯一接近的数字是使用上面输出第一行的数字:
1122097371 - 1122082971 = 14400
14400 / 48000 (the samplerate) = 0.3
但我完全不知道我在那里做什么,或者这是否有意义......;)
有人有这方面的经验并能帮我计算延迟吗?