In short, ffmpeg changes its API in recent versions. One of them is marking
AVStream.codec as deprecated. On other side, a AVCodecParameters
* AVStream.codecpar was added for codec information described in the stream. To decode data read from stream correctly, we must create a
avcodec_alloc_context3(), copy codec information from
AVStream.codecpar to this allocated
AVCodecContext, and call
avcodec_open2() to assign this
AVCodec found by
Here is the point. We must call
avcodec_parameters_to_context() to copy codec information to
AVCodecContext before we call
avcodec_open2() to assign
AVCodec. If we incorrectly reversed this order, say, called
avcodec_parameters_to_context(), we can still decode many videos correctly, but we will encounter strange behavior when we try to play back .mkv or .mp4 files – Each call to decoding function will fail.
if [ "$CONFIGURATION" == "Debug" ]; then
for a in $ARCHS; do
EXTRACT_ARCHS="$EXTRACT_ARCHS -extract $a"
lipo "$LIBFFMPEG_DIR/lib/libffmpeg.dylib" $EXTRACT_ARCHS -output "$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/libffmpeg.dylib"
if [ "$CODE_SIGNING_REQUIRED" == "YES" ]; then
codesign -s "$EXPANDED_CODE_SIGN_IDENTITY" "$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/libffmpeg.dylib"
install_name_tool -change "libffmpeg.dylib" "@executable_path/libffmpeg.dylib" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH"
Simply, clang has an option
'--no-integrated-as' so that the compiler invokes apple’s standalone
'as' assembler instead of using clang’s built-in. But, either has its own lost pieces.
'--no-integrated-as', clang would use its internal assembler. Unfortunately it doesn’t recognize the mnemonic
'as’ assembler reports an error in pesudo instruction
'.ios_version_min', which was apparently generated by clang itself.
Therefore I have no choice except for changing
'ldmltfd' to two simple instructions…