【问题标题】:Why seek on ts file is so slow?为什么在 ts 文件上查找这么慢?
【发布时间】:2015-09-16 20:20:33
【问题描述】:

我正在处理一个 ts 文件,以下是 ffprobe 输出:

ffprobe version N-45589-gb6a0b8b-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2007-2014 the FFmpeg developers
  built on Aug 28 2014 02:30:32 with gcc 4.8 (Debian 4.8.3-9)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  0.101 / 56.  0.101
  libavformat    56.  3.100 / 56.  3.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.103 /  5.  0.103
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[hevc @ 0x298b4a0] No start code is found.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] No start code is found.
    Last message repeated 2 times
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] No start code is found.
    Last message repeated 7 times
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] No start code is found.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[hevc @ 0x298b4a0] PPS id out of range: 0
[hevc @ 0x298b4a0] Error parsing NAL unit #2.
[mpegts @ 0x2987560] decoding for stream 0 failed
[mpegts @ 0x2987560] Could not find codec parameters for stream 0 (Video: hevc ([36][0][0][0] / 0x0024)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'mp4box-jlsj-4k.ts':
  Duration: 00:02:15.00, start: 0.001111, bitrate: 31116 kb/s
  Program 1
    Stream #0:0[0x65]: Video: hevc ([36][0][0][0] / 0x0024), 25 tbr, 90k tbn, 90k tbc
    Stream #0:1[0x66]: Audio: eac3, 48000 Hz, 5.1(side), fltp, 448 kb/s

我遇到的问题是在这个文件上查找非常慢,完成查找操作需要超过 1 分钟。

这个 ts 文件大小为 500MB,有 2,793,052 个 ts 包,2,750,469 个视频包,137 个带有 random_acces_indicator 的视频包。 寻道缓慢的可能原因是什么?为什么 ffmpeg 会报告这些错误?我需要为分析做什么?

【问题讨论】:

  • 你是怎么找的?在ffplay中?或者在您的应用程序中使用自定义代码?
  • 您应该添加生成此输出的命令。
  • 命令就是“ffprobe a.ts”,我在mpegts.c的函数mpegts_read_seek()中发现,调用read_seek2()很慢,但是调用read_seek()很快。

标签: ffmpeg stream seek transport


【解决方案1】:

我绝对不是hevc 专家,但输入文件的容器似乎已损坏或其中包含损坏的数据。

尝试使用:ffmpeg -i <<INPUT>> -c copy <<OUTPUT.ts>> 重新打包它。如果出现任何问题或文件中的数据损坏,ffmpeg 应报告。

【讨论】:

  • 文件格式错误。 ffmpeg 丢弃每个视频帧,结果文件中只剩下 audi 帧。
猜你喜欢
  • 1970-01-01
  • 2013-06-04
  • 2011-03-11
  • 1970-01-01
  • 2016-04-19
  • 2010-10-29
  • 2010-11-12
  • 2011-12-06
  • 1970-01-01
相关资源
最近更新 更多