<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <br> <div id="bloop_sign_1485720986397795072" class="bloop_sign"></div> <br><p class="airmail_on">On January 29, 2017 at 2:25:25 PM, films (<a href="mailto:postsoup-at-yahoo.com@ffmpeg.org">postsoup-at-yahoo.com@ffmpeg.org</a>) wrote:</p> <div><blockquote type="cite" class="clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div></div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:10px"><div id="yui_3_16_0_ym19_1_1485526183467_2806" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">Hi Folks.</div><div id="yui_3_16_0_ym19_1_1485526183467_2807" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2808"></div><div id="yui_3_16_0_ym19_1_1485526183467_2809" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">I am trying to write .mp4 files with H.264 and AAC from generated images and audio. My app is linked to libAVFormat, libAVCodec etc plus some necessary OSX frameworks</div><div id="yui_3_16_0_ym19_1_1485526183467_2810" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2811"></div><div id="yui_3_16_0_ym19_1_1485526183467_2812" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">If I let libAVFormat select the codecs for a file named xxxxx.mp4 using av_guess_format() it selects the MPEG4 and AAC encoders and everything is working **fine**</div><div id="yui_3_16_0_ym19_1_1485526183467_2813" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2814"></div><div id="yui_3_16_0_ym19_1_1485526183467_2815" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">However, I really need to use the H.264 codec instead of the MPEG4 video codec, so I have tried overriding the guessed codec by simply adding this after the av_guess_format stage.</div><div id="yui_3_16_0_ym19_1_1485526183467_2816" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2817"></div><div id="yui_3_16_0_ym19_1_1485526183467_2818" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">fmt->video_codec = AV_CODEC_ID_H264;</div><div id="yui_3_16_0_ym19_1_1485526183467_2819" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2820"></div><div id="yui_3_16_0_ym19_1_1485526183467_2821" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">However, having done that, libAVCodec appears to be failing when it calls through to the OSX VideoToolbox.framework.  </div><div id="yui_3_16_0_ym19_1_1485526183467_2822" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2823"></div><div id="yui_3_16_0_ym19_1_1485526183467_2824" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">[h264_videotoolbox @ 0x106806800] Error: cannot create compression session: -12908</div><div id="yui_3_16_0_ym19_1_1485526183467_2825" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">[h264_videotoolbox @ 0x106806800] Try -allow_sw 1. The hardware encoder may be busy, or not supported.</div><div id="yui_3_16_0_ym19_1_1485526183467_2826" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2827"></div><div id="yui_3_16_0_ym19_1_1485526183467_2828" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">In constrast, if I simply try using the ffmpeg binary app (built from the same libraries) to encode a source file into a .mp4 without specifying any parameters, it selects x264 and AAC and encodes without hitting any errors.  </div><div id="yui_3_16_0_ym19_1_1485526183467_2829" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2830"></div><div id="yui_3_16_0_ym19_1_1485526183467_2831" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">In the ffmpeg trace, I see lots of </div><div id="yui_3_16_0_ym19_1_1485526183467_2834" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">[libx264 ....</div><div id="yui_3_16_0_ym19_1_1485526183467_2834" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica"><br></div><div id="yui_3_16_0_ym19_1_1485526183467_2835" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">rather than the </div><div id="yui_3_16_0_ym19_1_1485526183467_2835" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica"><br></div><div id="yui_3_16_0_ym19_1_1485526183467_2836" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">[h264_videotoolbox ...</div><div id="yui_3_16_0_ym19_1_1485526183467_2837" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">I see in my own code.</div><div id="yui_3_16_0_ym19_1_1485526183467_2838" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2839"></div><div id="yui_3_16_0_ym19_1_1485526183467_2840" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">I have not been able to get past this issue and I wondered if anyone can shed any light.  Is the [libx264 .... encoding used by ffmpeg different to the [h264_videotoolbox ... attempt and fail in my app.</div><div id="yui_3_16_0_ym19_1_1485526183467_2841" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2842"></div><div id="yui_3_16_0_ym19_1_1485526183467_2843" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">If this is true then I guess I need to find a way to specify use of x264 instead of h264_videotoolbox.</div><div id="yui_3_16_0_ym19_1_1485526183467_2846" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">If thats the same thing then I need to understand why its failing in my direct calls, but working ok when ffmpeg calls it.</div><div id="yui_3_16_0_ym19_1_1485526183467_2846" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica"><br></div><div id="yui_3_16_0_ym19_1_1485526183467_2846" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">I ran the app on a completely different mac to eliminate any hardware dependancy in the VideoToolbox.framework and it doesn't throw the error but it only turns out one really nasty video frame and the rest of the output is blank.</div><div id="yui_3_16_0_ym19_1_1485526183467_2846" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica"><br></div><div id="yui_3_16_0_ym19_1_1485526183467_2846" dir="ltr" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">I am quite happy with software based x264 and don't need hardware acceleration through VideoToolbox.framework. How can I disable this ?  Compiling the libraries with -disable-videotoolbox in configure didn't make any diffference.</div></div></div></div></span></blockquote></div><p>You can download/compile/install x264 from source then re-run configure in FFmpeg. If you see “libx264” listed under “Enabled encoders” once configure completes, build/install and x264 will be available.</p><p>What Apple computer are you using? Which OS X version? Error “-12908” means the hardware encoder doesn’t exist, but this could be a bug.</p><div><blockquote type="cite" class="clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:10px"><div id="yui_3_16_0_ym19_1_1485526183467_2847" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br class="Apple-interchange-newline"><br id="yui_3_16_0_ym19_1_1485526183467_2848"></div><div id="yui_3_16_0_ym19_1_1485526183467_2849" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">There doesn't appear to be much in the way of updated documentation or example code for this sort of thing.</div><div id="yui_3_16_0_ym19_1_1485526183467_2850" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">Can anyone advise ?</div><div id="yui_3_16_0_ym19_1_1485526183467_2851" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2852"></div><div id="yui_3_16_0_ym19_1_1485526183467_2853" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica">Many thanks.</div><div id="yui_3_16_0_ym19_1_1485526183467_2854" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2855"></div><div id="yui_3_16_0_ym19_1_1485526183467_2856" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2857"></div><div id="yui_3_16_0_ym19_1_1485526183467_2569"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1485526183467_2858" style="margin-top:0px;margin-bottom:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br id="yui_3_16_0_ym19_1_1485526183467_2859"></div></div>_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br><a href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a><br></div></div></span></blockquote></div></body></html>