[FFmpeg-user] Problems saving rtsp stream directly as mpegts

Jonathan Viney jonathan.viney at gmail.com
Thu Nov 20 21:20:09 CET 2014


I had another look at this today and managed to find a solution.

Adding "-bsf:v dump_extra" makes the mpeg2ts output file readable by ffmpeg.

On Mon, Nov 3, 2014 at 3:38 PM, Jonathan Viney <jonathan.viney at gmail.com> wrote:
>
> On Mon, Nov 3, 2014 at 2:45 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>>
>> Jonathan Viney <jonathan.viney <at> gmail.com> writes:
>>
>> > ffmpeg -i rtsp://10.9.9.3:554/axis-media/media.amp -c copy -f mpegts
>> > out.ts
>> >
>> > This seems to work fine, but the output file is
>> > not recognised by ffmpeg/ffprobe.
>>
>> Complete, uncut console output missing.
>> (I would have expected above command to return an
>> error message and I would like to know why there
>> is no such message.)
>
>
> Here are the command outputs.
>
> ffmpeg -rtsp_transport tcp -i rtsp://10.9.9.3:554/axis-media/media.amp -c
> copy -y -t 5 out.ts
>
> ffmpeg version N-67343-gd457478 Copyright (c) 2000-2014 the FFmpeg
> developers
>   built on Nov  3 2014 15:19:39 with Apple LLVM version 6.0 (clang-600.0.54)
> (based on LLVM 3.5svn)
>   configuration: --enable-shared --enable-pthreads --enable-gpl
> --enable-version3 --enable-nonfree --enable-libx264 --enable-libvpx
> --prefix=/tmp/ffmpeg-test
>   libavutil      54. 11.100 / 54. 11.100
>   libavcodec     56. 10.101 / 56. 10.101
>   libavformat    56. 12.100 / 56. 12.100
>   libavdevice    56.  2.100 / 56.  2.100
>   libavfilter     5.  2.101 /  5.  2.101
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, rtsp, from 'rtsp://10.9.9.3:554/axis-media/media.amp':
>   Metadata:
>     title           : Media Presentation
>   Duration: N/A, start: 0.040011, bitrate: N/A
>     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1
> DAR 16:9], 25 fps, 25 tbr, 90k tbn, 180k tbc
> Output #0, mpegts, to 'out.ts':
>   Metadata:
>     title           : Media Presentation
>     encoder         : Lavf56.12.100
>     Stream #0:0: Video: h264, yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9],
> q=2-31, 25 fps, 90k tbn, 90k tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> [mpegts @ 0x7f9f22826a00] Non-monotonous DTS in output stream 0:0; previous:
> 0, current: 0; changing to 1. This may result in incorrect timestamps in the
> output file.
> frame=  127 fps= 32 q=-1.0 Lsize=    5774kB time=00:00:04.99
> bitrate=9460.9kbits/s
> video:5341kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 8.106906%
>
>
> ffprobe out.ts
>
> ffprobe out.ts
> ffprobe version N-67343-gd457478 Copyright (c) 2007-2014 the FFmpeg
> developers
>   built on Nov  3 2014 15:19:39 with Apple LLVM version 6.0 (clang-600.0.54)
> (based on LLVM 3.5svn)
>   configuration: --enable-shared --enable-pthreads --enable-gpl
> --enable-version3 --enable-nonfree --enable-libx264 --enable-libvpx
> --prefix=/tmp/ffmpeg-test
>   libavutil      54. 11.100 / 54. 11.100
>   libavcodec     56. 10.101 / 56. 10.101
>   libavformat    56. 12.100 / 56. 12.100
>   libavdevice    56.  2.100 / 56.  2.100
>   libavfilter     5.  2.101 /  5.  2.101
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
>   libpostproc    53.  3.100 / 53.  3.100
> [h264 @ 0x7fe783808000] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x7fe783808000] decode_slice_header error
> [h264 @ 0x7fe783808000] no frame!
> [h264 @ 0x7fe783808000] non-existing PPS 0 referenced
>     Last message repeated 1 times
> [h264 @ 0x7fe783808000] decode_slice_header error
> [h264 @ 0x7fe783808000] no frame!
> [h264 @ 0x7fe783808000] non-existing PPS 0 referenced
> (duplicate messages removed)
> [mpegts @ 0x7fe78300da00] decoding for stream 0 failed
> [mpegts @ 0x7fe78300da00] Could not find codec parameters for stream 0
> (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
> Consider increasing the value for the 'analyzeduration' and 'probesize'
> options
> out.ts: Operation not permitted
>
>>
>>
>> > If I do it in two steps, first saving the stream
>> > as a .mp4, it converts to mpegts fine with:
>> >
>> > ffmpeg -i out.mp4 -c copy -bsf h264_mp4toannexb out.ts
>> >
>> > Is it possible to do this in one step without the
>> > intermediary file?
>>
>> What happens if you add the bitstreamfilter to the
>> first command?
>
>
> ffmpeg -rtsp_transport tcp -i rtsp://10.9.9.3:554/axis-media/media.amp -c
> copy -y -bsf h264_mp4toannexb -t 5 out.ts
>
> ffmpeg version N-67343-gd457478 Copyright (c) 2000-2014 the FFmpeg
> developers
>   built on Nov  3 2014 15:19:39 with Apple LLVM version 6.0 (clang-600.0.54)
> (based on LLVM 3.5svn)
>   configuration: --enable-shared --enable-pthreads --enable-gpl
> --enable-version3 --enable-nonfree --enable-libx264 --enable-libvpx
> --prefix=/tmp/ffmpeg-test
>   libavutil      54. 11.100 / 54. 11.100
>   libavcodec     56. 10.101 / 56. 10.101
>   libavformat    56. 12.100 / 56. 12.100
>   libavdevice    56.  2.100 / 56.  2.100
>   libavfilter     5.  2.101 /  5.  2.101
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, rtsp, from 'rtsp://10.9.9.3:554/axis-media/media.amp':
>   Metadata:
>     title           : Media Presentation
>   Duration: N/A, start: 0.040000, bitrate: N/A
>     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1
> DAR 16:9], 25 fps, 25 tbr, 90k tbn, 180k tbc
> Output #0, mpegts, to 'out.ts':
>   Metadata:
>     title           : Media Presentation
>     encoder         : Lavf56.12.100
>     Stream #0:0: Video: h264, yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9],
> q=2-31, 25 fps, 90k tbn, 90k tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> [NULL @ 0x7fa97a820600] Packet header is not contained in global extradata,
> corrupted stream or invalid MP4/AVCC bitstream
> Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec
> copy: Invalid argument
> [NULL @ 0x7fa97a820600] Packet header is not contained in global extradata,
> corrupted stream or invalid MP4/AVCC bitstream
> Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec
> copy: Invalid argument
> [mpegts @ 0x7fa97a809600] Non-monotonous DTS in output stream 0:0; previous:
> 0, current: 0; changing to 1. This may result in incorrect timestamps in the
> output file.
> [NULL @ 0x7fa97a820600] Packet header is not contained in global extradata,
> corrupted stream or invalid MP4/AVCC bitstream
> Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec
> copy: Invalid argument
> (duplicate messages removed)
> frame=  127 fps= 31 q=-1.0 Lsize=    5280kB time=00:00:04.99
> bitrate=8651.6kbits/s
> video:4883kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 8.132199%
>
> The resulting output file gives the same errors as above when passed to
> ffprobe.
>
> Thanks for the help.
>
> Regards,
> -Jonathan.
>
>
>> Carl Eugen
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>


More information about the ffmpeg-user mailing list