<div dir="ltr"><div>I'm getting an error when remuxing an mp4 to an avi file. I'm dropping all packets except those coming from the first video stream from the input and writing the output with the following code: </div><div><br></div><div><a href="https://github.com/KognitionAI/pilecv4j/blob/master/native-ffmpeg/src/main/cpp/api/Muxer.cpp#L61">https://github.com/KognitionAI/pilecv4j/blob/master/native-ffmpeg/src/main/cpp/api/Muxer.cpp#L61</a><br></div><div><br></div><div>The writeFinalPacket is just an av_interleaved_write_frame with error handling.</div><div><br></div><div>I can remux to mp4 or mpegts with this code but when I try to remux to an avi I get a series of message like:</div><div>"[avi @ 0x7fae085a9b80] H.264 bitstream error, startcode missing, size 4343 data 000010F3"<br></div><div><br></div><div>The final file kinda-plays but starts gray, then after some frames play, turns gray again.</div><div><br></div><div>The command line works fine: ffmpeg -i input.mp4 -map 0:v -c:v copy output.avi</div><div><br></div><div>Any suggestions for correcting this and more robust muxing in general?</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Jim</div><div><br></div></div>