<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:10px"><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2806">Hi Folks.</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2807"><br id="yui_3_16_0_ym19_1_1485526183467_2808"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2809">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2810"><br id="yui_3_16_0_ym19_1_1485526183467_2811"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2812">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2813"><br id="yui_3_16_0_ym19_1_1485526183467_2814"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2815">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2816"><br id="yui_3_16_0_ym19_1_1485526183467_2817"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2818">fmt->video_codec = AV_CODEC_ID_H264;</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2819"><br id="yui_3_16_0_ym19_1_1485526183467_2820"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2821">However, having done that, libAVCodec appears to be failing when it calls through to the OSX VideoToolbox.framework.  </div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2822"><br id="yui_3_16_0_ym19_1_1485526183467_2823"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2824">[h264_videotoolbox @ 0x106806800] Error: cannot create compression session: -12908</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2825">[h264_videotoolbox @ 0x106806800] Try -allow_sw 1. The hardware encoder may be busy, or not supported.</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2826"><br id="yui_3_16_0_ym19_1_1485526183467_2827"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2828">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2829"><br id="yui_3_16_0_ym19_1_1485526183467_2830"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2831">In the ffmpeg trace, I see lots of </div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2834">[libx264 ....</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2834"><br></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2835">rather than the </div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2835"><br></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2836">[h264_videotoolbox ...</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2837">I see in my own code.</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2838"><br id="yui_3_16_0_ym19_1_1485526183467_2839"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2840">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2841"><br id="yui_3_16_0_ym19_1_1485526183467_2842"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2843">If this is true then I guess I need to find a way to specify use of x264 instead of h264_videotoolbox.</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2846">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2846"><br></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2846">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2846"><br></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2846" dir="ltr">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 style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2847"><br id="yui_3_16_0_ym19_1_1485526183467_2848"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2849">There doesn't appear to be much in the way of updated documentation or example code for this sort of thing.</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2850">Can anyone advise ?</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2851"><br id="yui_3_16_0_ym19_1_1485526183467_2852"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica;" id="yui_3_16_0_ym19_1_1485526183467_2853">Many thanks.</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2854"><br id="yui_3_16_0_ym19_1_1485526183467_2855"></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" id="yui_3_16_0_ym19_1_1485526183467_2856"><br id="yui_3_16_0_ym19_1_1485526183467_2857"></div><div id="yui_3_16_0_ym19_1_1485526183467_2569">



































</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; min-height: 14px;" dir="ltr" id="yui_3_16_0_ym19_1_1485526183467_2858"><br id="yui_3_16_0_ym19_1_1485526183467_2859"></div></div></body></html>