[FFmpeg-user] How to generate PTS for matroska? (Can't write packet with unknown timestamp)

wl2776 wl2776 at gmail.com
Mon Feb 6 14:43:00 CET 2012


I have a raw h264 video file, which I need to mux in the mkv container.


I write: 
  ffmpeg -y -f h264 -i 0000000291_00000000000000016454.h264 -f srt -i
0000000291_00000000000000016454.srt -vcodec copy -scodec copy
0000000291_00000000000000016454.mkv


I get:
ffmpeg version N-36036-g493447c, Copyright (c) 2000-2011 the FFmpeg
developers
  built on Dec 22 2011 12:03:43 with gcc 4.4.3
  configuration: --enable-gpl --enable-version3 --enable-nonfree
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 46. 1 / 53. 46. 1
  libavformat  53. 27. 0 / 53. 27. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[h264 @ 0xa363e80] mmco: unref short failure
[h264 @ 0xa363e80] Increasing reorder buffer to 1                                                                             
[h264 @ 0xa363e80] mmco: unref short failure                                                                                  
[h264 @ 0xa355ae0] max_analyze_duration 5000000 reached at 5000000                                                            
[h264 @ 0xa355ae0] Estimating duration from bitrate, this may be inaccurate                                                   
                                                                                                                              
Seems stream 0 codec frame rate differs from container frame rate: 50.00
(50/1) -> 25.00 (50/2)
Input #0, h264, from '0000000291_00000000000000016454.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 704x576 [SAR 12:11 DAR 4:3],
50 fps, 25 tbr, 1200k tbn, 50 tbc
[srt @ 0xa35e3a0] Estimating duration from bitrate, this may be inaccurate
Input #1, srt, from '0000000291_00000000000000016454.srt':                                                                    
  Duration: N/A, bitrate: N/A
    Stream #1:0: Subtitle: srt
Output #0, matroska, to '0000000291_00000000000000016454.mkv':
  Metadata:
    encoder         : Lavf53.27.0
    Stream #0:0: Video: h264, yuv420p, 704x576 [SAR 12:11 DAR 4:3], q=2-31,
50 fps, 1k tbn, 1200k tbc
    Stream #0:1: Subtitle: srt
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0xa35f160] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument         

Is there any way to make FFmpeg generate timestamps assuming constant
framerate?

I tried 
  -fflags genpts 
and 
  -vf "setpts=N"
and
  -vf "setpts=N/(25*TB)"

Nothing helps.

If I omit -vcodec copy, FFmpeg reencodes h264 to mpeg4 and saves video.

I would very much like to avoid such reencoding.


--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/How-to-generate-PTS-for-matroska-Can-t-write-packet-with-unknown-timestamp-tp4361266p4361266.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list