New submission from Anatoly madRat L.Berenblit <[email protected]>:

FFMPEG some times can not correctly convert mpegts from pipe, but works well
this the same file

In short: 
not works ./ffmpeg -y -i - -vcodec copy -acodec copy -f mpegts ~/out.ts <
~/badpipe.ts
works     ./ffmpeg -y -i ~/badpipe.ts -vcodec copy -acodec copy -f mpegts 
~/out.ts

sample file ftp://upload.ffmpeg.org/incoming/tspipe-bug/badpipe.ts
more detailed description -
ftp://upload.ffmpeg.org/incoming/tspipe-bug/description.txt
patch - ftp://upload.ffmpeg.org/incoming/tspipe-bug/tspipe.patch

----------
files: desc.txt
messages: 13792
priority: normal
status: new
substatus: open
title: av_find_stream_info may generate but data for outputs if input source is 
non-seekable
type: bug

________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue2636>
________________________________________________
BUG: FFMPEG some times can not correctly convert mpegts from pipe, but works 
well this the same file

This issue based on av_find_stream_info precaching.

When this function parse some input stream data (for input format detectoin) it 
stores readed packets 
in special buffer (AVFormatContext::packet_buffer).

Later (at av_read_packet), if input streams supports seek(files) - stream reset 
to seek(0) and parse packets again. For inputs w/o seek, 
first packets taking from packe_buffer.

For correct timestamp calculation needed stream info, that is returned by 
decoder after packet is added into packe_buffer, and if before returning to 
client packets will be fluash and re-read again - behaviour is correct (for 2nd 
parse of 1st packet all information (samplerate and etc) is available), but if 
seek is not available - for 1st packet at 1st pass - sample rate is invalid and 
packets timestamp/duration may be ugly.

This ugly timestamp of 2nd packet ( = timestamp of 1st packet + 
1st_packet_duration) crashes some format-outputs.


Solution:

After try_decode_frame update packet_buffer.

Patch is applied.

Sample - badpipe.ts

  not works ./ffmpeg -y -i - -vcodec copy -acodec copy -f mpegts ~/out.ts < 
~/badpipe.ts 
  works         ./ffmpeg -y -i ~/badpipe.ts -vcodec copy -acodec copy -f mpegts 
~/out.ts

Reply via email to