<div dir="ltr"><div>Hi,</div><div>how can one change coded_picture_number without fully decoding H.264 frames?</div><div><br></div><div>Some context:<br></div><div>we have recordings of RTP streams from IP-cameras (fragmented to 10-minutes pieces), made with Janus, and use Janus utility (<a href="https://github.com/meetecho/janus-gateway/blob/master/postprocessing/janus-pp-rec.c">https://github.com/meetecho/janus-gateway/blob/master/postprocessing/janus-pp-rec.c</a>, which calls <a href="https://github.com/meetecho/janus-gateway/blob/master/postprocessing/pp-h264.c">https://github.com/meetecho/janus-gateway/blob/master/postprocessing/pp-h264.c</a>) to convert them to MP4.</div><div><br></div><div>Resulted MP4 does not play in Google Chrome (though plays in Firefox or VLC); but if "convert" them with:</div><div>ffmpeg -i janus.mp4 -c copy out.mp4</div><div>— then out.mp4 plays well in Chrome.</div><div>Probable cause of the difference is that in janus.mp4 coded_picture_number starts from non-zero value, and in out.mp4 from zero.</div><div><br></div><div>I want to patch this utility to enumerate frames from zero. I've managed to do this with parsing AVPacket to AVFrames, but such a way involves full decoding-reencoding and is slow.</div><div><br></div><div>How can I change coded_picture_number without fully decoding H.264?</div><div><br></div><div>This is definitely possible, as ffmpeg with `-c copy` does this (and does fast). I've seen ffmpeg source, but don't understand where the key point is.</div><div>I also found the function av_parser_parse2, which seems to parse without decoding, but it's not clear what to do with its output byte array (all examples use it only for further decoding).</div><div><br></div><div>Regards, Alexey Golovko.<br></div></div>