Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On Tue, Sep 29, 2015 at 01:19:34PM -0400, DeHackEd wrote: > Assumes 'GA94' format (ATSC standard) > > Signed-off-by: DHE > --- > doc/encoders.texi| 4 > libavcodec/libx264.c | 45 + > 2 files changed, 49 insertions(+) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 4 libavcodec/libx264.c | 45 + 2 files changed, 49 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..f2d46dc 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,10 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc @var{boolean} +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..d4509d6 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -25,6 +25,7 @@ #include "libavutil/mem.h" #include "libavutil/pixdesc.h" #include "libavutil/stereo3d.h" +#include "libavutil/intreadwrite.h" #include "avcodec.h" #include "internal.h" @@ -83,6 +84,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +258,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,7 +281,48 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +if (x4->pic.extra_sei.payloads == NULL) { +av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); +goto skip_a53cc; +} +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +if (x4->pic.extra_sei.payloads[0].payload == NULL) { +av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); +av_freep(&x4->pic.extra_sei.payloads); +goto skip_a53cc; +} +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ +AV_WL32(x4->pic.extra_sei.payloads[0].payload + 3, +MKTAG('G', 'A', '9', '4')); +x4->pic.extra_sei.payloads[0].payload[7] = 3; +x4->pic.extra_sei.payloads[0].payload[8] = +((side_data->size/3) & 0x1f) | 0x40; +x4->pic.extra_sei.payloads[0].payload[9] = 0; +x4->pic.extra_sei.payloads[0].payload[side_data->size+10] = 255; +} +} } +skip_a53cc: do { if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) return AVERROR_EXTERNAL; @@ -821,6 +865,7 @@ static const AVOption options[] = { {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, +{"a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc),AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE}, {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE },
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 4 libavcodec/libx264.c | 46 ++ 2 files changed, 50 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..f2d46dc 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,10 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc @var{boolean} +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..9dc342a 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,7 +280,50 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +if (x4->pic.extra_sei.payloads == NULL) { +av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); +goto skip_a53cc; +} +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +if (x4->pic.extra_sei.payloads[0].payload == NULL) { +av_log(ctx, AV_LOG_ERROR, "Not enough memory for closed captions, skipping\n"); +av_freep(&x4->pic.extra_sei.payloads); +goto skip_a53cc; +} +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ +x4->pic.extra_sei.payloads[0].payload[3] = 'G'; +x4->pic.extra_sei.payloads[0].payload[4] = 'A'; +x4->pic.extra_sei.payloads[0].payload[5] = '9'; +x4->pic.extra_sei.payloads[0].payload[6] = '4'; +x4->pic.extra_sei.payloads[0].payload[7] = 3; +x4->pic.extra_sei.payloads[0].payload[8] = +((side_data->size/3) & 0x1f) | 0x40; +x4->pic.extra_sei.payloads[0].payload[9] = 0; +x4->pic.extra_sei.payloads[0].payload[side_data->size+10] = 255; +} +} } +skip_a53cc: do { if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) return AVERROR_EXTERNAL; @@ -821,6 +866,7 @@ static const AVOption options[] = { {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, +{"a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc),AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE}, {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, { "crf_max", "In CRF mode, prevents VBV from
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 09/26/15 03:27 AM, DeHackEd wrote: I think my mail client wrapped some lines. Sorry, this is my first patch-by-email. For Thunderbird, there is an extension, "Toggle Word Wrap" which gives the option of disabling word wrap under the Options menu. Or just attach. Dave ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 9/26/2015 8:41 AM, DeHackEd wrote: > +/** > + * 'GA94' is standard in North America for ATSC, but hard > coding > + * this style may not be the right thing to do -- other > formats > + * do exist. This information is not available in the > side_data > + * so we are going with this right now. > + */ > +x4->pic.extra_sei.payloads[0].payload[3] = 'G'; > +x4->pic.extra_sei.payloads[0].payload[4] = 'A'; > +x4->pic.extra_sei.payloads[0].payload[5] = '9'; > +x4->pic.extra_sei.payloads[0].payload[6] = '4'; AV_WL32(x4->pic.extra_sei.payloads[0].payload + 3, MKTAG('G', 'A', '9', '4')); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On Sat, Sep 26, 2015 at 07:41:32AM -0400, DeHackEd wrote: > Assumes 'GA94' format (ATSC standard) > > Signed-off-by: DHE > --- > doc/encoders.texi| 5 + > libavcodec/libx264.c | 37 + > 2 files changed, 42 insertions(+) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 3550bcc..aabbda0 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with > @command{ffmpeg}: > ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an > out.mkv > @end example > > +@item a53cc @var{boolean} > +Import closed captions (which must be ATSC compatible format) into output. > +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). > + > + > @item x264-params (N.A.) > Override the x264 configuration using a :-separated list of key=value > parameters. > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 58fcfb0..8540ff9 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -83,6 +83,7 @@ typedef struct X264Context { > int avcintra_class; > int motion_est; > int forced_idr; > +int a53_cc; > char *x264_params; > } X264Context; > > @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, > const AVFrame *frame, > int nnal, i, ret; > x264_picture_t pic_out = {0}; > int pict_type; > +AVFrameSideData *side_data; > > x264_picture_init( &x4->pic ); > x4->pic.img.i_csp = x4->params.i_csp; > @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket > *pkt, const AVFrame *frame, > X264_TYPE_AUTO; > > reconfig_encoder(ctx, frame); > + > +if (x4->a53_cc) { > +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); > +if (side_data) { > +x4->pic.extra_sei.num_payloads = 1; > +x4->pic.extra_sei.payloads = > av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); missing malloc failure check > +x4->pic.extra_sei.sei_free = av_free; > + > +x4->pic.extra_sei.payloads[0].payload_size = side_data->size > + 11; > +x4->pic.extra_sei.payloads[0].payload = > av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); missing malloc failure check > +x4->pic.extra_sei.payloads[0].payload_type = 4; > +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, > side_data->data, side_data->size); > +x4->pic.extra_sei.payloads[0].payload[0] = 181; > +x4->pic.extra_sei.payloads[0].payload[1] = 0; > +x4->pic.extra_sei.payloads[0].payload[2] = 49; > + > +/** > + * 'GA94' is standard in North America for ATSC, but hard > coding > + * this style may not be the right thing to do -- other > formats > + * do exist. This information is not available in the > side_data > + * so we are going with this right now. > + */ > +x4->pic.extra_sei.payloads[0].payload[3] = 'G'; > +x4->pic.extra_sei.payloads[0].payload[4] = 'A'; > +x4->pic.extra_sei.payloads[0].payload[5] = '9'; > +x4->pic.extra_sei.payloads[0].payload[6] = '4'; > +x4->pic.extra_sei.payloads[0].payload[7] = 3; > +x4->pic.extra_sei.payloads[0].payload[8] = > +((side_data->size/3) & 0x1f) | 0x40; > +x4->pic.extra_sei.payloads[0].payload[9] = 0; > +x4->pic.extra_sei.payloads[0].payload[side_data->size+10] = > 255; > +} > +} > + > } > do { > if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, > &pic_out) < 0) > @@ -821,6 +857,7 @@ static const AVOption options[] = { > {"level", "Specify level (as defined by Annex A)", OFFSET(level), > AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, > {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), > AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, > {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), > AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, > +{"a53cc", "Use A53 Closed Captions (if available)", > OFFSET(a53_cc),AV_OPT_TYPE_INT,{.i64 = 0}, 0, 1, VE}, AV_OPT_TYPE_BOOL [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 5 + libavcodec/libx264.c | 37 + 2 files changed, 42 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..aabbda0 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc @var{boolean} +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..8540ff9 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ +x4->pic.extra_sei.payloads[0].payload[3] = 'G'; +x4->pic.extra_sei.payloads[0].payload[4] = 'A'; +x4->pic.extra_sei.payloads[0].payload[5] = '9'; +x4->pic.extra_sei.payloads[0].payload[6] = '4'; +x4->pic.extra_sei.payloads[0].payload[7] = 3; +x4->pic.extra_sei.payloads[0].payload[8] = +((side_data->size/3) & 0x1f) | 0x40; +x4->pic.extra_sei.payloads[0].payload[9] = 0; +x4->pic.extra_sei.payloads[0].payload[side_data->size+10] = 255; +} +} + } do { if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) @@ -821,6 +857,7 @@ static const AVOption options[] = { {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, +{"a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc),AV_OPT_TYPE_INT,{.i64 = 0}, 0, 1, VE}, {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, { "crf_max", "In CRF mode, prevents VBV from lowering quality beyond this point.",OFFSET(crf_max), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, -- 1.8.4.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 09/26/2015 04:16 PM, Anshul wrote: On 09/26/2015 03:57 PM, DeHackEd wrote: On 09/26/2015 05:26 AM, Anshul wrote: On 09/26/2015 05:46 AM, DeHackEd wrote: Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 5 + libavcodec/libx264.c | 37 + 2 files changed, 42 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..bb16dea 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..4227bcc 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +x4->pic.extra_sei.sei_free = av_free; + + x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); + x4->pic.extra_sei.payloads[0].payload_type = 4; + memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ I think GA94 is correct for this situation, since in our x264 decoder we don't consider any other standard for extracting closed caption. I don't know if we have any logic which differentiate between ATSC, ISDB or DVB we parse all transport stream in same manner. if someone know where we differentiate atsc and dvb in FFmpeg please point me there. Note: This logic will also fail when x264 is muxed in formats like gxf where closed caption are kept in vbi instead of GA94. Overall LGTM. I don't know how to apply encrypted mails using git, and when I save your email in Thunderbird, git am is unable to apply. if you can send the same patch as attachment or command to convert encrypted .eml file to normal patch I would test this too. I think the easiest solution is to grab the patch from the github repo I use: https://github.com/DeHackEd/FFmpeg/commit/16b4c7fc2311d672e99f.patch anshul@linux-z9q9:~/Project/Multimedia/FFmpeg> git apply 16b4c7fc2311d672e99f.patch 16b4c7fc2311d672e99f.patch:54: trailing whitespace. 16b4c7fc2311d672e99f.patch:75: trailing whitespace. */ 16b4c7fc2311d672e99f.patch:81: trailing whitespace. x4->pic.extra_sei.payloads[0].payload[8] = warning: 3 lines add whitespace errors. anshul@linux-z9q9:~/Project/Multimedia/FFmpeg> Though I have fixed it at my end to test, but my advice that you fix it too and send another patch. It works fine for me. -Anshul ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 09/26/2015 03:57 PM, DeHackEd wrote: On 09/26/2015 05:26 AM, Anshul wrote: On 09/26/2015 05:46 AM, DeHackEd wrote: Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 5 + libavcodec/libx264.c | 37 + 2 files changed, 42 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..bb16dea 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..4227bcc 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ I think GA94 is correct for this situation, since in our x264 decoder we don't consider any other standard for extracting closed caption. I don't know if we have any logic which differentiate between ATSC, ISDB or DVB we parse all transport stream in same manner. if someone know where we differentiate atsc and dvb in FFmpeg please point me there. Note: This logic will also fail when x264 is muxed in formats like gxf where closed caption are kept in vbi instead of GA94. Overall LGTM. I don't know how to apply encrypted mails using git, and when I save your email in Thunderbird, git am is unable to apply. if you can send the same patch as attachment or command to convert encrypted .eml file to normal patch I would test this too. I think the easiest solution is to grab the patch from the github repo I use: https://github.com/DeHackEd/FFmpeg/commit/16b4c7fc2311d672e99f.patch anshul@linux-z9q9:~/Project/Multimedia/FFmpeg> git apply 16b4c7fc2311d672e99f.patch 16b4c7fc2311d672e99f.patch:54: trailing whitespace. 16b4c7fc2311d672e99f.patch:75: trailing whitespace. */ 16b4c7fc2311d672e99f.patch:81: trailing whitespace. x4->pic.extra_sei.payloads[0].payload[8] = warning: 3 lines add whitespace errors. anshul@linux-z9q9:~/Project/Multimedia/FFmpeg> Though I have fixed it at my end to test, but my advice that you fix it too and send another patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 09/26/2015 05:26 AM, Anshul wrote: > > > On 09/26/2015 05:46 AM, DeHackEd wrote: >> Assumes 'GA94' format (ATSC standard) >> >> Signed-off-by: DHE >> --- >> doc/encoders.texi| 5 + >> libavcodec/libx264.c | 37 + >> 2 files changed, 42 insertions(+) >> >> diff --git a/doc/encoders.texi b/doc/encoders.texi >> index 3550bcc..bb16dea 100644 >> --- a/doc/encoders.texi >> +++ b/doc/encoders.texi >> @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with >> @command{ffmpeg}: >> ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an >> out.mkv >> @end example >> >> +@item a53cc >> +Import closed captions (which must be ATSC compatible format) into output. >> +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). >> + >> + >> @item x264-params (N.A.) >> Override the x264 configuration using a :-separated list of key=value >> parameters. >> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c >> index 58fcfb0..4227bcc 100644 >> --- a/libavcodec/libx264.c >> +++ b/libavcodec/libx264.c >> @@ -83,6 +83,7 @@ typedef struct X264Context { >> int avcintra_class; >> int motion_est; >> int forced_idr; >> +int a53_cc; >> char *x264_params; >> } X264Context; >> >> @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket >> *pkt, const AVFrame *frame, >> int nnal, i, ret; >> x264_picture_t pic_out = {0}; >> int pict_type; >> +AVFrameSideData *side_data; >> >> x264_picture_init( &x4->pic ); >> x4->pic.img.i_csp = x4->params.i_csp; >> @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket >> *pkt, const AVFrame *frame, >> X264_TYPE_AUTO; >> >> reconfig_encoder(ctx, frame); >> + >> +if (x4->a53_cc) { >> +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); >> +if (side_data) { >> +x4->pic.extra_sei.num_payloads = 1; >> +x4->pic.extra_sei.payloads = >> av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); >> +x4->pic.extra_sei.sei_free = av_free; >> + >> +x4->pic.extra_sei.payloads[0].payload_size = >> side_data->size + 11; >> +x4->pic.extra_sei.payloads[0].payload = >> av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); >> +x4->pic.extra_sei.payloads[0].payload_type = 4; >> +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, >> side_data->data, side_data->size); >> +x4->pic.extra_sei.payloads[0].payload[0] = 181; >> +x4->pic.extra_sei.payloads[0].payload[1] = 0; >> +x4->pic.extra_sei.payloads[0].payload[2] = 49; >> + >> +/** >> + * 'GA94' is standard in North America for ATSC, but hard >> coding >> + * this style may not be the right thing to do -- other >> formats >> + * do exist. This information is not available in the >> side_data >> + * so we are going with this right now. >> + */ > I think GA94 is correct for this situation, since in our x264 decoder we > don't consider any other standard > for extracting closed caption. > > I don't know if we have any logic which differentiate between ATSC, ISDB or > DVB we parse all transport stream > in same manner. if someone know where we differentiate atsc and dvb in FFmpeg > please point me there. > > Note: This logic will also fail when x264 is muxed in formats like gxf where > closed caption are kept in vbi instead > of GA94. > > Overall LGTM. > > I don't know how to apply encrypted mails using git, and when I save your > email in Thunderbird, git am is unable to apply. > if you can send the same patch as attachment or command to convert encrypted > .eml file to normal patch I would test this > too. I think the easiest solution is to grab the patch from the github repo I use: https://github.com/DeHackEd/FFmpeg/commit/16b4c7fc2311d672e99f.patch I think my mail client wrapped some lines. Sorry, this is my first patch-by-email. > > -Anshul > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 09/26/2015 05:46 AM, DeHackEd wrote: Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 5 + libavcodec/libx264.c | 37 + 2 files changed, 42 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..bb16dea 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..4227bcc 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ I think GA94 is correct for this situation, since in our x264 decoder we don't consider any other standard for extracting closed caption. I don't know if we have any logic which differentiate between ATSC, ISDB or DVB we parse all transport stream in same manner. if someone know where we differentiate atsc and dvb in FFmpeg please point me there. Note: This logic will also fail when x264 is muxed in formats like gxf where closed caption are kept in vbi instead of GA94. Overall LGTM. I don't know how to apply encrypted mails using git, and when I save your email in Thunderbird, git am is unable to apply. if you can send the same patch as attachment or command to convert encrypted .eml file to normal patch I would test this too. -Anshul ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 5 + libavcodec/libx264.c | 37 + 2 files changed, 42 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..bb16dea 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc +Import closed captions (which must be ATSC compatible format) into output. +Only the mpeg2 and h264 decoders provide these. Default is 0 (off). + + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..4227bcc 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ +x4->pic.extra_sei.payloads[0].payload[3] = 'G'; +x4->pic.extra_sei.payloads[0].payload[4] = 'A'; +x4->pic.extra_sei.payloads[0].payload[5] = '9'; +x4->pic.extra_sei.payloads[0].payload[6] = '4'; +x4->pic.extra_sei.payloads[0].payload[7] = 3; +x4->pic.extra_sei.payloads[0].payload[8] = + ((side_data->size/3) & 0x1f) | 0x40; +x4->pic.extra_sei.payloads[0].payload[9] = 0; +x4->pic.extra_sei.payloads[0].payload[side_data->size+10] = 255; +} +} + } do { if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) @@ -821,6 +857,7 @@ static const AVOption options[] = { {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, +{"a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc),AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE}, {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, { "crf_max", "In CRF mode, prevents VBV from lowering quality beyond this point.",OFFSET(crf_max), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, -- 1.8.4.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
On 09/25/2015 07:45 PM, Carl Eugen Hoyos wrote: > DeHackEd dehacked.net> writes: > >> + item a53cc >> +Import closed captions (which must be ATSC compatible format) into output. >> +At this time only the mpeg2 decoder provides these. > > I thought the h264 decoder also provides them, no? Indeed, you are correct. Not sure how I missed that. A quick test (using my own output) came up positive so I'll just update the docs. > > Carl Eugen > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
DeHackEd dehacked.net> writes: > + item a53cc > +Import closed captions (which must be ATSC compatible format) into output. > +At this time only the mpeg2 decoder provides these. I thought the h264 decoder also provides them, no? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source
Assumes 'GA94' format (ATSC standard) Signed-off-by: DHE --- doc/encoders.texi| 5 + libavcodec/libx264.c | 37 + 2 files changed, 42 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 3550bcc..8e3770b 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with @command{ffmpeg}: ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv @end example +@item a53cc +Import closed captions (which must be ATSC compatible format) into output. +At this time only the mpeg2 decoder provides these. Default is 0 (off). + + @item x264-params (N.A.) Override the x264 configuration using a :-separated list of key=value parameters. diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 58fcfb0..4227bcc 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -83,6 +83,7 @@ typedef struct X264Context { int avcintra_class; int motion_est; int forced_idr; +int a53_cc; char *x264_params; } X264Context; @@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, int nnal, i, ret; x264_picture_t pic_out = {0}; int pict_type; +AVFrameSideData *side_data; x264_picture_init( &x4->pic ); x4->pic.img.i_csp = x4->params.i_csp; @@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, X264_TYPE_AUTO; reconfig_encoder(ctx, frame); + +if (x4->a53_cc) { +side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC); +if (side_data) { +x4->pic.extra_sei.num_payloads = 1; +x4->pic.extra_sei.payloads = av_mallocz(sizeof(x4->pic.extra_sei.payloads[0])); +x4->pic.extra_sei.sei_free = av_free; + +x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11; +x4->pic.extra_sei.payloads[0].payload = av_mallocz(x4->pic.extra_sei.payloads[0].payload_size); +x4->pic.extra_sei.payloads[0].payload_type = 4; +memcpy(x4->pic.extra_sei.payloads[0].payload + 10, side_data->data, side_data->size); +x4->pic.extra_sei.payloads[0].payload[0] = 181; +x4->pic.extra_sei.payloads[0].payload[1] = 0; +x4->pic.extra_sei.payloads[0].payload[2] = 49; + +/** + * 'GA94' is standard in North America for ATSC, but hard coding + * this style may not be the right thing to do -- other formats + * do exist. This information is not available in the side_data + * so we are going with this right now. + */ +x4->pic.extra_sei.payloads[0].payload[3] = 'G'; +x4->pic.extra_sei.payloads[0].payload[4] = 'A'; +x4->pic.extra_sei.payloads[0].payload[5] = '9'; +x4->pic.extra_sei.payloads[0].payload[6] = '4'; +x4->pic.extra_sei.payloads[0].payload[7] = 3; +x4->pic.extra_sei.payloads[0].payload[8] = + ((side_data->size/3) & 0x1f) | 0x40; +x4->pic.extra_sei.payloads[0].payload[9] = 0; +x4->pic.extra_sei.payloads[0].payload[side_data->size+10] = 255; +} +} + } do { if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) @@ -821,6 +857,7 @@ static const AVOption options[] = { {"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, {"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, +{"a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc),AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE}, {"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE}, { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, { "crf_max", "In CRF mode, prevents VBV from lowering quality beyond this point.",OFFSET(crf_max), AV_OPT_TYPE_FLOAT, {.dbl = -1 }, -1, FLT_MAX, VE }, -- 1.8.4.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel