<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi all,<br><br></div>I'm having an issue with avformat_find_stream_info() not pulling the timing information out of an H264 stream that I am parsing in real time as it comes off of my camera. I've cobbled together my stream detection code by reading scattered tutorials, libav-user threads, and diving into the libavformat/libavcodec code base, so there is much room for error on my part in how I am trying to achieve this. That said, I think it is prudent that I start by explaining my use case thoroughly for context, following which I will provide my code and results.<br><br></div>I have a custom camera built by an OEM which outputs a 1080p@30fps H264 elementary stream over USB. Its interface is simple: I provide it a callback that takes a buffer, a size, and void* userData, and it calls that callback each time it has finished producing a frame. The frame is guaranteed to be a complete NAL unit. My goal is to take the live stream from the camera, detect the format of the video, mux each frame into a fragmented MP4 container (1 NAL unit per container), and shoot each muxed frame off to another program to be used as a live stream. I am also trying to get each of these frames through the pipeline with the lowest latency possible, trying to avoid buffering of any form. For the most part, this process is working great and I've got live MP4 video streaming in my other application and rendering correctly. However, in the stream format detection stage, I get some warning messages and lots of missing fields when it comes to timing information, and that missing timing information sometimes causes problems in my other program (and other video services) when it comes to playback speed.<br><br></div>All of my re-muxing logic is contained in this class:<br><br><a href="https://github.com/OpenROV-Dev/geomuxpp/blob/inproc_rewrite/src/CMuxer.h">https://github.com/OpenROV-Dev/geomuxpp/blob/inproc_rewrite/src/CMuxer.h</a><br><a href="https://github.com/OpenROV-Dev/geomuxpp/blob/inproc_rewrite/src/CMuxer.cpp">https://github.com/OpenROV-Dev/geomuxpp/blob/inproc_rewrite/src/CMuxer.cpp</a><br><br></div>Data is dumped into the CVideoBuffer m_inputBuffer structure by the camera callback. When data is available, the muxer gets signaled to process the NAL unit. First it builds up a couple megabytes of data to probe, then it finds the stream info, and ultimately constructs an output AVIO context for muxing to MP4 using all of the parsed stream info. Then each packet is muxed and written out using the custom WritePacket callback which sends the data out over ZeroMQ.<br><br></div><div>Here is the output of my program with AV traces on (Note: Using FFMPEG latest stable source tarball, 3.0.1 from 2/24/16):<br></div><br>-------------------------<br>---------NEW RUN---------<br>Channels created: 1<br>Application Started.<br>Init success<br>Input: 21092 bytes at: 1461658579098<br>Input: 45508 bytes at: 1461658579132<br>Input: 39348 bytes at: 1461658579165<br>Input: 37716 bytes at: 1461658579199<br>Input: 38372 bytes at: 1461658579232<br>Input: 37016 bytes at: 1461658579265<br>Input: 37324 bytes at: 1461658579299<br>Input: 35600 bytes at: 1461658579332<br>Input: 35400 bytes at: 1461658579365<br>Input: 36160 bytes at: 1461658579399<br>Input: 36708 bytes at: 1461658579432<br>Input: 36472 bytes at: 1461658579465<br>Input: 36896 bytes at: 1461658579499<br>Input: 34628 bytes at: 1461658579532<br>Input: 34728 bytes at: 1461658579565<br>Input: 34476 bytes at: 1461658579598<br>Input: 35084 bytes at: 1461658579632<br>Input: 36344 bytes at: 1461658579665<br>Input: 36200 bytes at: 1461658579698<br>Input: 38156 bytes at: 1461658579732<br>Input: 35280 bytes at: 1461658579765<br>Input: 34252 bytes at: 1461658579798<br>Input: 34768 bytes at: 1461658579832<br>Input: 34612 bytes at: 1461658579865<br>Input: 35624 bytes at: 1461658579898<br>Input: 36408 bytes at: 1461658579932<br>Input: 35048 bytes at: 1461658579965<br>Input: 35252 bytes at: 1461658579998<br>Input: 34852 bytes at: 1461658580032<br>Input: 33968 bytes at: 1461658580065<br>Input: 34004 bytes at: 1461658580098<br>Input: 35048 bytes at: 1461658580132<br>Input: 34676 bytes at: 1461658580165<br>Input: 35212 bytes at: 1461658580198<br>Input: 34636 bytes at: 1461658580232<br>Input: 33448 bytes at: 1461658580265<br>Input: 34016 bytes at: 1461658580298<br>Input: 34288 bytes at: 1461658580332<br>Input: 34244 bytes at: 1461658580365<br>Input: 34276 bytes at: 1461658580398<br>Input: 34628 bytes at: 1461658580431<br>Input: 34212 bytes at: 1461658580465<br>Input: 33684 bytes at: 1461658580498<br>Input: 33536 bytes at: 1461658580531<br>Input: 33520 bytes at: 1461658580565<br>Input: 35332 bytes at: 1461658580598<br>Input: 34404 bytes at: 1461658580631<br>Input: 33956 bytes at: 1461658580665<br>Input: 33176 bytes at: 1461658580698<br>Input: 34100 bytes at: 1461658580731<br>Input: 34072 bytes at: 1461658580765<br>Input: 33724 bytes at: 1461658580798<br>Input: 34064 bytes at: 1461658580831<br>Input: 33976 bytes at: 1461658580865<br>Input: 33888 bytes at: 1461658580898<br>Input: 34124 bytes at: 1461658580931<br>Input: 34008 bytes at: 1461658580965<br>Input: 33412 bytes at: 1461658580998<br>Probing input buffer for format info...<br>Input: 33892 bytes at: 1461658581031<br>Input: 33312 bytes at: 1461658581065<br>Input: 33012 bytes at: 1461658581098<br>Input: 33724 bytes at: 1461658581131<br>Input: 33900 bytes at: 1461658581165<br>Input: 34272 bytes at: 1461658581198<br>Input: 33016 bytes at: 1461658581231<br>Input: 33612 bytes at: 1461658581265<br>Input: 33300 bytes at: 1461658581298<br>Input: 34348 bytes at: 1461658581331<br>Input: 34340 bytes at: 1461658581365<br>Input: 34268 bytes at: 1461658581398<br>Input: 33764 bytes at: 1461658581431<br>Input: 34008 bytes at: 1461658581464<br>Input: 33800 bytes at: 1461658581498<br>Input: 34504 bytes at: 1461658581531<br>Input: 33864 bytes at: 1461658581564<br>Input: 34600 bytes at: 1461658581598<br>Input: 34528 bytes at: 1461658581631<br>Input: 34516 bytes at: 1461658581664<br>Input: 35412 bytes at: 1461658581698<br>Input: 34676 bytes at: 1461658581731<br>Input: 34936 bytes at: 1461658581764<br>Input: 34548 bytes at: 1461658581798<br>Input: 34156 bytes at: 1461658581831<br>Input: 34256 bytes at: 1461658581864<br>Input: 33472 bytes at: 1461658581898<br>Input: 34264 bytes at: 1461658581931<br>Input: 33808 bytes at: 1461658581964<br>Input: 33868 bytes at: 1461658581998<br>Input: 101692 bytes at: 1461658582029<br>Input: 13188 bytes at: 1461658582064<br>Input: 244 bytes at: 1461658582097<br>Input: 936 bytes at: 1461658582130<br>Input: 5140 bytes at: 1461658582164<br>Input: 16340 bytes at: 1461658582197<br>Input: 43772 bytes at: 1461658582231<br>Input: 38212 bytes at: 1461658582264<br>Input: 36572 bytes at: 1461658582298<br>Input: 36184 bytes at: 1461658582331<br>Input: 36608 bytes at: 1461658582364<br>Input: 35452 bytes at: 1461658582398<br>Input: 35320 bytes at: 1461658582431<br>Input: 35088 bytes at: 1461658582464<br>Input: 34248 bytes at: 1461658582497<br>Input: 35396 bytes at: 1461658582531<br>Input: 35016 bytes at: 1461658582564<br>Input: 35368 bytes at: 1461658582597<br>Input: 34368 bytes at: 1461658582631<br>Input: 34492 bytes at: 1461658582664<br>Input: 35032 bytes at: 1461658582697<br>Input: 35036 bytes at: 1461658582731<br>Input: 34364 bytes at: 1461658582764<br>Input: 33140 bytes at: 1461658582797<br>Input: 33800 bytes at: 1461658582831<br>Input: 33888 bytes at: 1461658582864<br>Input: 33548 bytes at: 1461658582897<br>Input: 33196 bytes at: 1461658582931<br>Input: 33556 bytes at: 1461658582964<br>Input: 34600 bytes at: 1461658582997<br>Probing input buffer for format info...<br>Probing h264 score:51 size:2005772<br>Successfully acquired input format.<br>Input opened successfully!<br>Finding stream info...<br>[h264 @ 0x7fcd400008c0] Before avformat_find_stream_info() pos: 0 bytes read:2005772 seeks:0<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>Input: [h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>34228 bytes at: 1461658583031<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] non-existing PPS 0 referenced<br>[h264 @ 0x7fcd400022a0] decode_slice_header error<br>[h264 @ 0x7fcd400022a0] no frame!<br>[h264 @ 0x7fcd400022a0] Current profile doesn't provide more RBSP data in PPS, skipping<br>Input: 33400 bytes at: 1461658583064<br>[h264 @ 0x7fcd400008c0] 0: start_time: -9223372036854.775 duration: -9223372036854.775<br>[h264 @ 0x7fcd400008c0] stream: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=0 kb/s                                   <br>[h264 @ 0x7fcd400008c0] After avformat_find_stream_info() pos: 2073400 bytes read:2073400 seeks:0 frames:62<br>Input #0, h264, from '(null)':<br>  Duration: N/A, bitrate: N/A<br>    Stream #0:0, 62, 1/1200000: Video: h264 (Main), 1 reference frame, yuv420p(tv, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 1001/30000, 17.25 fps, 14.99 tbr, 1200k tbn, 29.97 tbc<br>Stream info acquired.<br>Finding codec...<br>Opening codec...<br>detected 8 logical cores<br>Codec opened.<br>Created output stream.<br>Copied input codec context to output codec context.<br>Writing FTYP+MOOV...<br>[mp4 @ 0x7fcd400010c0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.<br>Writing muxed packet. Bytes: 24<br>Writing muxed packet. Bytes: 754<br>Ready to mux!<br>Input: 33764 bytes at: 1461658583097<br>[mp4 @ 0x7fcd400010c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly                                                                                                                <br>[mp4 @ 0x7fcd400010c0] Encoder did not produce proper pts, making some up.                                                                   <br>Writing muxed packet. Bytes: 33872<br>Input: 33804 bytes at: 1461658583131<br>Writing muxed packet. Bytes: 33912<br>Input: 34424 bytes at: 1461658583164<br>Writing muxed packet. Bytes: 34532<br>Input: 34152 bytes at: 1461658583197<br>Writing muxed packet. Bytes: 34260<br>Input: 34168 bytes at: 1461658583231<br>Writing muxed packet. Bytes: 34276<br>Input: 34072 bytes at: 1461658583264<br>Writing muxed packet. Bytes: 34180<br>Input: 33940 bytes at: 1461658583297<br>Writing muxed packet. Bytes: 34048<br>Input: 34448 bytes at: 1461658583331<br>Writing muxed packet. Bytes: 34556<br>Input: 33808 bytes at: 1461658583364<br>Writing muxed packet. Bytes: 33916<br>Input: 33916 bytes at: 1461658583397<br>Writing muxed packet. Bytes: 34024<br>Input: 34492 bytes at: 1461658583431<br>Writing muxed packet. Bytes: 34600<br>Input: 34384 bytes at: 1461658583464<br>Writing muxed packet. Bytes: 34492<br>Input: 33324 bytes at: 1461658583497<br>Writing muxed packet. Bytes: 33432<br>Input: 33184 bytes at: 1461658583530<br>Writing muxed packet. Bytes: 33292<br>Input: 33336 bytes at: 1461658583564<br>Writing muxed packet. Bytes: 33444<br>Input: 32800 bytes at: 1461658583597<br>Writing muxed packet. Bytes: 32908<br>Input: 32956 bytes at: 1461658583630<br>Writing muxed packet. Bytes: 33064<br>Input: 33092 bytes at: 1461658583664<br>Writing muxed packet. Bytes: 33200<br>Input: 32972 bytes at: 1461658583697<br>Writing muxed packet. Bytes: 33080<br>Input: 33516 bytes at: 1461658583730<br>Writing muxed packet. Bytes: 33624<br>Input: 33700 bytes at: 1461658583764<br>Writing muxed packet. Bytes: 33808<br>Input: 33836 bytes at: 1461658583797<br>Writing muxed packet. Bytes: 33944<br>Input: 34164 bytes at: 1461658583830<br>Writing muxed packet. Bytes: 34272<br>Input: 34460 bytes at: 1461658583864<br>Writing muxed packet. Bytes: 34568<br>Input: 34052 bytes at: 1461658583897<br>Writing muxed packet. Bytes: 34160<br>Input: 34072 bytes at: 1461658583930<br>Writing muxed packet. Bytes: 34180<br>Input: 34720 bytes at: 1461658583964<br>Writing muxed packet. Bytes: 34828<br>^C<br><br><br></div>Breaking this down, we save up a bunch of packets, attempt a probe, but it fails. We save up some more frames and probe again. This time, the first 30 or so frames in the probe data buffer were associated with a PPS/SPS in the previous discarded probeData buffer, so I believe that explains the first stream of error messages. Eventually, it gets a new IDR-frame with a fresh PPS/SPS and the probe is successful. The next bit brings me to my first question:<br><br>[h264 @ 0x7fcd400008c0] 0: start_time: -9223372036854.775 duration: -9223372036854.775<br>[h264
 @ 0x7fcd400008c0] stream: start_time: -9223372036854.775 duration: 
-9223372036854.775 bitrate=0 kb/s                                   <br>[h264 @ 0x7fcd400008c0] After avformat_find_stream_info() pos: 2073400 bytes read:2073400 seeks:0 frames:62<br><br></div>Why are these time stamps and bitrate always garbage? Calling av_dump_format on the input format context gives:<br></div><br>Input #0, h264, from '(null)':<br>  Duration: N/A, bitrate: N/A<br>    
Stream #0:0, 62, 1/1200000: Video: h264 (Main), 1 reference frame, 
yuv420p(tv, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 1001/30000,
 17.25 fps, 14.99 tbr, 1200k tbn, 29.97 tbc<br><br></div>The FPS value here is weird, as it is a 30fps stream, as evidenced by my callback timestamps (units in milliseconds). The TBC looks correct, but the fps is way off, and the TBR is half of what I expect it to be. No idea where the 1200k TBN came from. Here is the data contained in an SPS segment of this stream. There is some timing information under the VUI section:<br><br><br><div><div><div><div>

<p style="margin:0px;text-indent:0px">==================== NAL ====================</p>
<p style="margin:0px;text-indent:0px"> forbidden_zero_bit :0</p>
<p style="margin:0px;text-indent:0px"> nal_ref_idc :3</p>
<p style="margin:0px;text-indent:0px"> nal_unit_type : 7Sequence parameter set</p><p style="margin:0px;text-indent:0px"><br></p>
<p style="margin:0px;text-indent:0px">======= SPS =======</p>
<p style="margin:0px;text-indent:0px"> profile_idc :77</p>
<p style="margin:0px;text-indent:0px"> constraint_set0_flag :0</p>
<p style="margin:0px;text-indent:0px"> constraint_set1_flag :1</p>
<p style="margin:0px;text-indent:0px"> constraint_set2_flag :0</p>
<p style="margin:0px;text-indent:0px"> constraint_set3_flag :0</p>
<p style="margin:0px;text-indent:0px"> constraint_set4_flag :0</p>
<p style="margin:0px;text-indent:0px"> constraint_set5_flag :0</p>
<p style="margin:0px;text-indent:0px"> reserved_zero_2bits :0</p>
<p style="margin:0px;text-indent:0px"> level_idc :31</p>
<p style="margin:0px;text-indent:0px"> seq_parameter_set_id :0</p>
<p style="margin:0px;text-indent:0px"> chroma_format_idc :1</p>
<p style="margin:0px;text-indent:0px"> residual_colour_transform_flag :0</p>
<p style="margin:0px;text-indent:0px"> bit_depth_luma_minus8 :0</p>
<p style="margin:0px;text-indent:0px"> bit_depth_chroma_minus8 :0</p>
<p style="margin:0px;text-indent:0px"> qpprime_y_zero_transform_bypass_flag :0</p>
<p style="margin:0px;text-indent:0px"> seq_scaling_matrix_present_flag :0</p>
<p style="margin:0px;text-indent:0px"> log2_max_frame_num_minus4 :0</p>
<p style="margin:0px;text-indent:0px"> pic_order_cnt_type :0</p>
<p style="margin:0px;text-indent:0px">   log2_max_pic_order_cnt_lsb_minus4 :6</p>
<p style="margin:0px;text-indent:0px">   delta_pic_order_always_zero_flag :0</p>
<p style="margin:0px;text-indent:0px">   offset_for_non_ref_pic :0</p>
<p style="margin:0px;text-indent:0px">   offset_for_top_to_bottom_field :0</p>
<p style="margin:0px;text-indent:0px">   num_ref_frames_in_pic_order_cnt_cycle :0</p>
<p style="margin:0px;text-indent:0px"> num_ref_frames :1</p>
<p style="margin:0px;text-indent:0px"> gaps_in_frame_num_value_allowed_flag :0</p>
<p style="margin:0px;text-indent:0px"> pic_width_in_mbs_minus1 :119</p>
<p style="margin:0px;text-indent:0px"> pic_height_in_map_units_minus1 :67</p>
<p style="margin:0px;text-indent:0px"> frame_mbs_only_flag :1</p>
<p style="margin:0px;text-indent:0px"> mb_adaptive_frame_field_flag :0</p>
<p style="margin:0px;text-indent:0px"> direct_8x8_inference_flag :1</p>
<p style="margin:0px;text-indent:0px"> frame_cropping_flag :1</p>
<p style="margin:0px;text-indent:0px">   frame_crop_left_offset :0</p>
<p style="margin:0px;text-indent:0px">   frame_crop_right_offset :0</p>
<p style="margin:0px;text-indent:0px">   frame_crop_top_offset :0</p>
<p style="margin:0px;text-indent:0px">   frame_crop_bottom_offset :4</p>
<p style="margin:0px;text-indent:0px"> vui_parameters_present_flag :1</p><p style="margin:0px;text-indent:0px"><br></p>
<p style="margin:0px;text-indent:0px">=== VUI ===</p>
<p style="margin:0px;text-indent:0px"> aspect_ratio_info_present_flag :1</p>
<p style="margin:0px;text-indent:0px">   aspect_ratio_idc :1</p>
<p style="margin:0px;text-indent:0px">     sar_width :0</p>
<p style="margin:0px;text-indent:0px">     sar_height :0</p>
<p style="margin:0px;text-indent:0px"> overscan_info_present_flag :0</p>
<p style="margin:0px;text-indent:0px">   overscan_appropriate_flag :0</p>
<p style="margin:0px;text-indent:0px"> video_signal_type_present_flag :1</p>
<p style="margin:0px;text-indent:0px">   video_format :0</p>
<p style="margin:0px;text-indent:0px">   video_full_range_flag :0</p>
<p style="margin:0px;text-indent:0px">   colour_description_present_flag :0</p>
<p style="margin:0px;text-indent:0px">     colour_primaries :0</p>
<p style="margin:0px;text-indent:0px">   transfer_characteristics :0</p>
<p style="margin:0px;text-indent:0px">   matrix_coefficients :0</p>
<p style="margin:0px;text-indent:0px"> chroma_loc_info_present_flag :0</p>
<p style="margin:0px;text-indent:0px">   chroma_sample_loc_type_top_field :0</p>
<p style="margin:0px;text-indent:0px">   chroma_sample_loc_type_bottom_field :0</p>
<p style="margin:0px;text-indent:0px"> timing_info_present_flag :1</p>
<p style="margin:0px;text-indent:0px">   num_units_in_tick :6006</p>
<p style="margin:0px;text-indent:0px">   time_scale :180000</p>
<p style="margin:0px;text-indent:0px">   fixed_frame_rate_flag :0</p>
<p style="margin:0px;text-indent:0px"> nal_hrd_parameters_present_flag :1</p>
<p style="margin:0px;text-indent:0px"> vcl_hrd_parameters_present_flag :1</p>
<p style="margin:0px;text-indent:0px">   low_delay_hrd_flag :0</p>
<p style="margin:0px;text-indent:0px"> pic_struct_present_flag :0</p>
<p style="margin:0px;text-indent:0px"> bitstream_restriction_flag :0</p>
<p style="margin:0px;text-indent:0px">   motion_vectors_over_pic_boundaries_flag :0</p>
<p style="margin:0px;text-indent:0px">   max_bytes_per_pic_denom :0</p>
<p style="margin:0px;text-indent:0px">   max_bits_per_mb_denom :0</p>
<p style="margin:0px;text-indent:0px">   log2_max_mv_length_horizontal :0</p>
<p style="margin:0px;text-indent:0px">   log2_max_mv_length_vertical :0</p>
<p style="margin:0px;text-indent:0px">   num_reorder_frames :0</p>
<p style="margin:0px;text-indent:0px">   max_dec_frame_buffering :0</p><p style="margin:0px;text-indent:0px"><br></p>
<p style="margin:0px;text-indent:0px">=== HRD ===</p>
<p style="margin:0px;text-indent:0px"> cpb_cnt_minus1 :0</p>
<p style="margin:0px;text-indent:0px"> bit_rate_scale :0</p>
<p style="margin:0px;text-indent:0px"> cpb_size_scale :0</p>
<p style="margin:0px;text-indent:0px">   bit_rate_value_minus1[0] :218749</p>
<p style="margin:0px;text-indent:0px">   cpb_size_value_minus1[0] :874999</p>
<p style="margin:0px;text-indent:0px">   cbr_flag[0] :0</p>
<p style="margin:0px;text-indent:0px"> initial_cpb_removal_delay_length_minus1 :31</p>
<p style="margin:0px;text-indent:0px"> cpb_removal_delay_length_minus1 :31</p>
<p style="margin:0px;text-indent:0px"> dpb_output_delay_length_minus1 :31</p>
<p style="margin:0px;text-indent:0px"> time_offset_length :24</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">The encoder goes on to give me a few more warnings, which I can only assume are related to having bad timing info from the decode step.</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">In summary, does anyone know why this timing info might be so botched? Additionally, is the logic employed in my code sound? There is very little in the way of documentation/tutorials for working with raw streams from a custom input buffer, and I haven't really found anyone else trying to mux each frame like I have, so it is very possible that I've made many mistakes (I'm surprised this works as well as it does).</p><p style="margin:0px;text-indent:0px"><br></p><p style="margin:0px;text-indent:0px">Thanks,</p><p style="margin:0px;text-indent:0px">Charles<br></p>
<p style="margin:0px;text-indent:0px"><br></p></div></div></div></div></div>