[FFmpeg-devel] [PATCH] ffmpeg: Support copying unknown streams

Michael Niedermayer michaelni at gmx.at
Thu May 21 18:25:41 CEST 2015


On Thu, May 21, 2015 at 05:27:53PM +0200, wm4 wrote:
> On Thu, 21 May 2015 17:18:49 +0200
> Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > On Thu, May 21, 2015 at 10:20:46AM +0200, wm4 wrote:
> > > On Thu, 21 May 2015 00:40:41 +0200
> > > Michael Niedermayer <michaelni at gmx.at> wrote:
> > > 
> > > > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > > > ---
> > > >  ffmpeg.c     |    1 +
> > > >  ffmpeg_opt.c |   14 ++++++++++++++
> > > >  2 files changed, 15 insertions(+)
> > > > 
> > > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > > index a89ae39..da3ab91 100644
> > > > --- a/ffmpeg.c
> > > > +++ b/ffmpeg.c
> > > > @@ -2822,6 +2822,7 @@ static int transcode_init(void)
> > > >                  enc_ctx->width  = dec_ctx->width;
> > > >                  enc_ctx->height = dec_ctx->height;
> > > >                  break;
> > > > +            case AVMEDIA_TYPE_UNKNOWN:
> > > >              case AVMEDIA_TYPE_DATA:
> > > >              case AVMEDIA_TYPE_ATTACHMENT:
> > > >                  break;
> > > > diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> > > > index a8d433e..4b783a5 100644
> > > > --- a/ffmpeg_opt.c
> > > > +++ b/ffmpeg_opt.c
> > > > @@ -1565,6 +1565,19 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc, int
> > > >      return ost;
> > > >  }
> > > >  
> > > > +static OutputStream *new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
> > > > +{
> > > > +    OutputStream *ost;
> > > > +
> > > > +    ost = new_output_stream(o, oc, AVMEDIA_TYPE_UNKNOWN, source_index);
> > > > +    if (!ost->stream_copy) {
> > > > +        av_log(NULL, AV_LOG_FATAL, "Unknown stream encoding not supported yet (only streamcopy)\n");
> > > > +        exit_program(1);
> > > > +    }
> > > > +
> > > > +    return ost;
> > > > +}
> > > > +
> > > >  static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
> > > >  {
> > > >      OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT, source_index);
> > > > @@ -2016,6 +2029,7 @@ loop_end:
> > > >                  case AVMEDIA_TYPE_AUDIO:      ost = new_audio_stream     (o, oc, src_idx); break;
> > > >                  case AVMEDIA_TYPE_SUBTITLE:   ost = new_subtitle_stream  (o, oc, src_idx); break;
> > > >                  case AVMEDIA_TYPE_DATA:       ost = new_data_stream      (o, oc, src_idx); break;
> > > > +                case AVMEDIA_TYPE_UNKNOWN:    ost = new_unknown_stream   (o, oc, src_idx); break;
> > > >                  case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break;
> > > >                  default:
> > > >                      av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n",
> > > 
> > > Doesn't this raise the risk of creating invalid files?
> > 
> > i dont know
> > ive posted a patch that would require the user to explicitly enable
> > copying unknown streams, if you prefer that ?
> > 
> > [...]
> > 
> 
> Yes, thanks, that's much better.

ok applied that

thanks

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

There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150521/14795637/attachment.asc>


More information about the ffmpeg-devel mailing list