Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2453 closed defect (worksforme)

Applying h264_mp4toannexb on RTSP stream produces: "Failed to open bitstream filter...: Invalid Argument"

Reported by: Daniele Orlandi Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: rtsp h264
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello,

I'm taking the RTSP stream from an AXIS camera and saving it to a MPEG transport stream. The ultimate goal is to segment it in a HLS stream.

/home/vihai/ffmpeg/ffmpeg -rtsp_transport tcp -i "rtsp://195.72.223.6:555/axis-media/media.amp?streamprofile=streaming_450&camera=1" \
   -vcodec copy -acodec copy \
   -bsf h264_mp4toannexb \
   out.ts

Applying the h264_mp4toannexb bitstream filter directly is produces:

ffmpeg version N-51696-gb4eb06d Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr  9 2013 17:52:58 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 25.100 / 52. 25.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  1.100 / 55.  1.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 49.101 /  3. 49.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, rtsp, from 'rtsp://195.72.223.6:555/axis-media/media.amp?streamprofile=streaming_450&camera=1':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.020375, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuvj420p, 800x450 [SAR 1:1 DAR 16:9], 10 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: aac, 16000 Hz, mono, fltp
Output #0, mpegts, to 'a.ts':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf55.1.100
    Stream #0:0: Video: h264, yuvj420p, 800x450 [SAR 1:1 DAR 16:9], q=2-31, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac, 16000 Hz, mono
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
[adts @ 0x1d552e0] Encoder did not produce proper pts, making some up.
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument

If, however, I do take the stream, convert it to flv and pipe it again to ffmpeg the error goes away:

ffmpeg -rtsp_transport tcp -i "rtsp://195.72.223.6:555/axis-media/media.amp?streamprofile=streaming_720&camera=1" -re -vcodec copy -acodec copy -f flv - |\
ffmpeg -i - -re \
   -vcodec copy -acodec copy \
   -vbsf h264_mp4toannexb \
   out.ts

This makes me presume I'm not trying to do something impossible :)

The camera's IP address is real and temporarily open if you want to test directly.

The issue seems somewhat to be related to RTSP. If I dump the stream in mp4 and then convert it to ts with the bitstream filter it works.

Attachments (1)

dump.txt (58.2 KB ) - added by Daniele Orlandi 12 years ago.
Dump with transport stream debugging enabled

Download all attachments as: .zip

Change History (3)

by Daniele Orlandi, 12 years ago

Attachment: dump.txt added

Dump with transport stream debugging enabled

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: rtsp h264 added
Resolution: worksforme
Status: newclosed
$ ffmpeg -rtsp_transport tcp -i "rtsp://195.72.223.6:555/axis-media/media.amp?streamprofile=streaming_450&camera=1" -vcodec copy -acodec copy -bsf dump_extra out.ts

in reply to:  1 comment:2 by Daniele Orlandi, 12 years ago

Replying to cehoyos:

-bsf dump_extra out.ts

Hey, this is so impolite! With all the time it took to prepare the bug report you come here with a so quick solution? :)

Thank you! :)

...but what does "dump_extra" do?

Note: See TracTickets for help on using tickets.