Estoy acostumbrado a grabar programas de TV que no son HD, uso DGIndex para convertir el archivo ts resultante y continuar eliminando comerciales, transcodificar a mp4, ...

Ahora grabé un programa de televisión en 1080p. Dado que DGIndex no funciona en esos y la DLL de DGAVCIndex, DGAVCDecode.dll causa muchos bloques, necesito encontrar una nueva forma de hacer las cosas. Lo que me interesa es cómo DGIndex / DGAVCIndex detecta el retraso de audio. Pensé que ffmpeg es más sofisticado y no debería ser un problema verlo allí, pero no puedo.

Aquí está la salida de 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:\>

Nota: a pesar de las líneas h264, el video se reproduce bien.

Después de lanzar el servicio de fotogramas de VirtualDub, AviSynth y ffmpeg en el video mis ojos y oídos me dicen que en el archivo resultante el audio está apagado por aproximadamente -350ms según VLC. En otras palabras, pensé que podría encontrar algo en la salida de ffmpeg que me llevaría a esos 350 ms.

También usé el interruptor de ffmpeg -debug_tsy obtuve líneas como:

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

Con ffmpeg's -fdebug tsobtengo líneas como:

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

El único número cercano que pude obtener es usar los números de la primera línea de la salida anterior:

1122097371 - 1122082971 = 14400
14400 / 48000 (the samplerate) = 0.3

Pero no tengo ni idea de lo que estoy haciendo allí o si se supone que tiene sentido ...;)

¿Alguien tiene experiencia con esto y me puede ayudar a calcular el retraso?

sjngm
fuente