[FFmpeg-devel] [PATCH] libavfromat/flvenc.c: Preserve the 'amf0' data stream written by Adobe Flash Media Servers while doing a data stream copy

Michael Niedermayer michaelni at gmx.at
Thu Mar 14 20:33:22 CET 2013


On Sat, Mar 09, 2013 at 10:10:45AM +0100, Benedict Endemann wrote:
> From: Benedict Endemann <bendemann at make.tv>
> 
> The Adobe Flash Media Server is able to record incoming rtmp streams form connected Adobe Flash Players to disk. It is also able to add an amf0 data stream to these files.
> Incoming Streams containing a h.264 video track are recorded to Quicktime/Mpeg4 containers (f4v) and streams with other video codecs are recorded to FLV containers.
> The problem is, that availabel audio codecs on the encoder (the Adobe Flash Player) are non-standard for Mpeg4 containers. Due to this, the Adobe Flash Player isn't able to playback f4v files recorded by the Adobe Flash Media Server with audio playback without conversion!
> 
> With this patch it is possible to preserve the amf0 data stream while doing a container conversion from Mpeg4 to FLV containers while preserving the data stream that is lost otherwise.
> ---
>  libavformat/flvenc.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 502da0f..8c8e524 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -225,7 +225,8 @@ static int flv_write_header(AVFormatContext *s)
>                  return AVERROR_INVALIDDATA;
>              break;
>          case AVMEDIA_TYPE_DATA:
> -            if (enc->codec_id != AV_CODEC_ID_TEXT) {
> +            // 'amf0' is the codec_tag used by the Adobe Flash Media Server for the 'amf0' data packets
> +            if (enc->codec_id != AV_CODEC_ID_TEXT && enc->codec_tag != MKTAG('a','m','f','0')) {
>                  av_log(s, AV_LOG_ERROR, "Data codec '%s' for stream %d is not compatible with FLV\n",
>                         avcodec_get_name(enc->codec_id), i);
>                  return AVERROR_INVALIDDATA;

if you want to add support for storing action script tracks then
probably you should add a AV_CODEC_ID_"action scrit something"
and use that instead of the codec tag

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130314/077d6c0d/attachment.asc>


More information about the ffmpeg-devel mailing list