ffmpeg:在流 #1 中找不到编解码器的标签,容器当前不支持编解码器

问题描述 投票:0回答:2

我正在尝试在命令行中使用 ffmpeg 从我的 ip 摄像机流录制视频

fmpeg -rtsp_transport tcp \
>  -i rtsp://192.168.0.250/stream1 \
>  -c copy \
>  -map 0 \
>  -f segment \
>  -segment_time 60 \
>  -segment_format mp4 \
>  "/home/video/stream-%010d.mp4"

并得到下一个输出:

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from 'rtsp://192.168.0.250/stream1':
  Metadata:
    title           : Session streamed by "nessyMediaServer"
    comment         : h264
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2048x1536 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1: Data: none
[segment @ 0x559e20000980] Opening '/home/video/stream-0000000000.mp4' for writing
[mp4 @ 0x559e1fffc180] Could not find tag for codec none in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

尝试了一些不同的选项,例如

-c:v libx265 
-c:v libx264 
,但它不起作用,输出有点不同。但主要错误是相同的:

Could not find tag for codec none in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

UPD:尝试了下一个命令:

 ffmpeg -rtsp_transport tcp \
 -i rtsp://192.168.0.250/stream1 \
 -c copy \
 -map 0 \
 -f segment \
 -segment_time 60 \
 -segment_format avi \
 "/home/video/stream-%010d.avi"

开始录制视频,但出现错误:

fmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from 'rtsp://192.168.0.250/stream1':
  Metadata:
    title           : Session streamed by "nessyMediaServer"
    comment         : h265
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 2048x1536 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1: Data: none
[segment @ 0x562200721d80] Opening '/home/evgeniy/video/stream-0000000000.avi' for writing
Output #0, segment, to '/home/video/stream-%010d.avi':
  Metadata:
    title           : Session streamed by "nessyMediaServer"
    comment         : h265
    encoder         : Lavf58.29.100
    Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 2048x1536 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Data: none
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[segment @ 0x562200721d80] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x562200721d80] Non-monotonous DTS in output stream 0:0; previous: 202, current: 202; changing to 203. This may result in incorrect timestamps in the output file.
...
[segment @ 0x562200721d80] Non-monotonous DTS in output stream 0:0; previous: 748, current: 748; changing to 749. This may result in incorrect timestamps in the output file.
[segment @ 0x562200721d80] Opening '/home/video/stream-0000000001.avi' for writing
[avi @ 0x56220077d800] Too large number of skipped frames 5417887 > 6000001x    
av_interleaved_write_frame(): Invalid argument
[avi @ 0x56220077d800] Too large number of skipped frames 5407879 > 60000
frame= 1505 fps= 25 q=-1.0 Lsize=N/A time=00:01:00.24 bitrate=N/A speed=1.01x    
video:5314kB audio:0kB subtitle:0kB other streams:359kB global headers:0kB muxing overhead: unknown
Conversion failed!

ubuntu video ffmpeg rtsp
2个回答
15
投票

Stream #0:1 是未知数据,但 MP4 复用器不知道如何处理它。

  • -map 0
    更改为
    -map 0:v
    ,仅映射视频。
  • 或者保留
    -map 0
    并通过添加
    -map -0:d
    省略数据流。

参见 FFmpeg Wiki:地图


0
投票

我遇到了同样的问题,然后我只是输入

sudo apt update && sudo apt full-upgrade
来升级我的
ffmpeg
软件。

# -- firstly upgrade packages
sudo apt update && sudo apt full-upgrade

# -- retry conversion
ffmpeg -i input.avi -c copy output.mp4
© www.soinside.com 2019 - 2024. All rights reserved.