id,summary,reporter,owner,description,type,status,priority,component,version,resolution,keywords,cc,blockedby,blocking,reproduced,analyzed
1979,Automatically set -fflags +genpts,cehoyos,,"Several tickets were opened by users who saw one of the following error messages when trying to remux: ""first pts value must set"" or ""Can't write packet with unknown timestamp""
With the sample from ticket #1553:
{{{
$ ffmpeg -i Ts\ cannot\ be\ muxed\ to\ mkv.ts -vcodec copy -an out.mkv
ffmpeg version N-47291-g0b14c19 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 29 2012 21:54:38 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52.  9.102 / 52.  9.102
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 40.100 / 54. 40.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.104 /  3. 23.104
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 0x326b240] PES packet size mismatch
[mpegts @ 0x326b240] Could not find codec parameters for stream 2 (Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, s16): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[NULL @ 0x3270380] start time is not set in estimate_timings_from_pts
[mpegts @ 0x326b240] PES packet size mismatch
Input #0, mpegts, from 'Ts cannot be muxed to mkv.ts':
  Duration: 00:00:01.79, start: 58016.615744, bitrate: 9158 kb/s
  Program 1
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 384 kb/s
    Stream #0:2[0x35]: Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, s16
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf54.40.100
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 29.97 fps, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x3272ec0] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument
}}}
Adding -fflags +genpts fixes the problem, maybe this should be added automatically if necessary:
{{{
$ ffmpeg -fflags +genpts -i Ts\ cannot\ be\ muxed\ to\ mkv.ts -vcodec copy -an out.mkv
ffmpeg version N-47291-g0b14c19 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 29 2012 21:54:38 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52.  9.102 / 52.  9.102
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 40.100 / 54. 40.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.104 /  3. 23.104
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 0x195b340] PES packet size mismatch
[mpegts @ 0x195b340] Could not find codec parameters for stream 2 (Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, s16): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[NULL @ 0x1960540] start time is not set in estimate_timings_from_pts
[mpegts @ 0x195b340] PES packet size mismatch
Input #0, mpegts, from 'Ts cannot be muxed to mkv.ts':
  Duration: 00:00:01.79, start: 58016.615744, bitrate: 9158 kb/s
  Program 1
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 384 kb/s
    Stream #0:2[0x35]: Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, s16
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf54.40.100
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 29.97 fps, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   33 fps=0.0 q=-1.0 Lsize=    1440kB time=00:00:00.96 bitrate=12189.4kbits/s
video:1439kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.068458%
}}}
See also ticket #1415, #1552 and #1553.",enhancement,new,wish,FFmpeg,git-master,,av_interleaved_write_frame,ramitbhalla@…,,,0,0
