<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>Hello,</div><div><br></div><div>I've been trying to use transcoding.c as a starting place for my project and I can't seem to get it to work properly.</div><div><br></div><div>I have an .mp4 file that I want to transcode to .avi...all good until now.  </div><div><br></div><div>When transcoding it fails saying that I should use the aac_adtstoasc filter.</div><div><br></div><div>I looked around the internet for quite some time and I added the following code near line 367, before the ret = av_interleaved_write_frame(ofmt_ctx, &enc_pkt):</div><div><br></div><div>if (ifmt_ctx->streams[stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO)<br>  {<br>   AVBitStreamFilterContext* aacbsfc = av_bitstream_filter_init("aac_adtstoasc");<br>   av_bitstream_filter_filter(aacbsfc, ifmt_ctx->streams[stream_index]->codec, NULL, &enc_pkt.data, &enc_pkt.size, enc_pkt.data, enc_pkt.size, 0);<br>   av_bitstream_filter_close(aacbsfc);<br>  }<br> </div><div>Now it passes, generates the file but I can't open the file in anything other than VLC. BSplayer even crashes with a seg fault. Looks like ffmpeg doesn't write the headers properly</div><div><br></div><div>What am I doing wrong? (I'm using the latest version of FFMPEG)</div>                                           </div></body>
</html>