<div dir="ltr">Hi everyone,<div><br></div><div>I'm trying to slow down a mp4 video. I've read that i should use setpts filter for video and atempo filter for audio. The setpts filter works pretty good, but there is no way to make atempo works. I'm using the transcoding ffmpeg example (<a href="https://ffmpeg.org/doxygen/trunk/doc_2examples_2transcoding_8c-example.html">https://ffmpeg.org/doxygen/trunk/doc_2examples_2transcoding_8c-example.html</a>), and changed the filter_spec from "null" and "anull" to "setpts=2*PTS" and "atempo=0.5" respectively. The problem is the audio encoder complains about the frame size:</div><div><br></div><div><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[libfdk_aac @ 06de5960] more samples than frame size (avcodec_encode_audio2)</span><br></div><div><br></div><div>Here is the complete log for the execution:</div><div><br></div><div><p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../highlight.mp4':</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Metadata:</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> major_brand : isom</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> minor_version : 512</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> compatible_brands: isomiso2avc1mp41</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> encoder : Lavf56.38.100</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Duration: 00:00:10.09, start: 0.000000, bitrate: 734 kb/s</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 432x240 [SAR 1:1 DAR 9:5], 597 kb/s, 29.97 fps, 29.97 tbr, 120k tbn, 119.88 tbc (default)</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Metadata:</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> handler_name : VideoHandler</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Metadata:</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> handler_name : SoundHandler</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[libx264 @ 01b115e0] using SAR=1/1</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[libx264 @ 01b115e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[libx264 @ 01b115e0] profile High, level 3.1</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">Output #0, mp4, to '../highlightLento.mp4':</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Stream #0:0: Video: h264 (libx264), yuv420p, 432x240 [SAR 1:1 DAR 9:5], q=10-51, 128 kb/s, 119.88 tbc</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)"> Stream #0:1: Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 128 kb/s</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[mp4 @ 01b11080] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[mp4 @ 01b11080] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[swscaler @ 06e288e0] deprecated pixel format used, make sure you did set range correctly</span></p>
<p style="margin:0px"><span style="font-family:Courier;font-size:10pt;color:rgb(170,0,0)">[libfdk_aac @ 06de5960] more samples than frame size (avcodec_encode_audio2)</span></p></div><div><br></div><div>I searched for the exact line where the message is printed and it compares the nb_samples in the AVFrame with the frame_size in the AVCodecContext gave to the avcodec_encode_audio2 function.</div><div>So the question is, what is the correct way to set up the output codec context to works with the atempo filter? I supposed the filter will do all the work but it seems i was wrong.</div><div><br></div><div>Any help would be very appreciated.</div><div>Thanks in advance.</div><div><br></div><div>Kind regards,</div><div><br></div><div>Sebastián Arriagada.</div><div><br></div></div>