[FFmpeg-trac] #4266(avformat:new): FFM container now needs codec even with stream copy

FFmpeg trac at avcodec.org
Fri Jan 16 11:58:29 CET 2015


#4266: FFM container now needs codec even with stream copy
----------------------------------+--------------------------------------
             Reporter:  biskitt   |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 Summary of the bug:
 I use a small hand-made ffmpeg.exe, without some encoders. In this case,
 no h264 encoder: I use it only to dump rtsp streams, with stream copy.

 Since 2.5.x, the encoder is needed, even with stream copy. The
 avformat_write_header() function failed EINVAL error (-22). Everything is
 fine if I use avi format, or a version before one of this two commit:
 6690d4c3f53bd46144f3c13afcc77bcca3f7bb0b
 745730c9c208c40f800d5d71ffa39aceab6ce044

 It failed on this code, since I do not have the encoder:
 {{{
 const AVCodec *enc = ctx->codec ? ctx->codec :
 avcodec_find_encoder(ctx->codec_id);

 if (!enc)
     return AVERROR(EINVAL);
 }}}

 I tried to get rid of this enc by myself, but it failed. I do not know the
 serialization system well enough to go on by myself.
 Again, it works well with other containers (such as avi) of before those
 commits, so I do not think having the encoder for stream copy in ffm
 format is needed: I was able to ffplay the output.ffm produced by 2.4.x
 version without issue.

 How to reproduce (from 2.5.2 version, same behaviour with git-master):
 {{{
 % ffmpeg -i rtsp://input -codec copy -flags +global_header -f ffm
 output.ffm
 ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
   built on Jan  8 2015 20:47:33 with gcc 4.8.1 (GCC)
   configuration: --disable-static --enable-shared --disable-w32threads
 --enable-
 pthreads --disable-doc --prefix=redist --extra-cflags=-DPTW32_STATIC_LIB
 --extra
 -ldflags=-static-libgcc
   libavutil      54. 15.100 / 54. 15.100
   libavcodec     56. 13.100 / 56. 13.100
   libavformat    56. 15.102 / 56. 15.102
   libavdevice    56.  3.100 / 56.  3.100
   libavfilter     5.  2.103 /  5.  2.103
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
 Input #0, rtsp, from 'rtsp://input':
   Metadata:
     title           : Media Presentation
   Duration: N/A, start: 0.517600, bitrate: N/A
     Stream #0:0: Video: h264 (Main), yuv420p, 1280x720, 12 fps, 25 tbr,
 90k tbn,
  24 tbc
 Output #0, ffm, to 'output.ffm':
   Metadata:
     title           : Media Presentation
     encoder         : Lavf56.15.102
     Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, 12 fps, 1000k
 tbn, 12 t
 bc
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
 Could not write header for output file #0 (incorrect codec parameters ?):
 Error
 number -22 occurred
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4266>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list