Opened 7 years ago
Last modified 7 years ago
#7974 new defect
RTSP h265 input produces invalid MP4 output with -c copy
| Reported by: | Kenny Levinsen | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avcodec |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
Taking a RTSP HEVC main profile input from a HikVision IP PTZ camera, and producing an mp4 with -c copy, results in an invalid mp4 file.
Reading this mp4 file results in the following errors:
[AVBSFContext @ 0x55f87e9a1f00] No start code is found. /tmp/test3.mp4: Invalid data found when processing input
VLC, mpv and ffmpeg are all unable to read the file, despite all being able to play the stream live without problem. However, if one outputs to a TS file, the output is entirely usable, and can afterwards be remuxed to mp4 without issue.
The issue seems identical to this mailing list post from 2017, which unfortunately had no followup: https://ffmpeg.org/pipermail/libav-user/2017-November/010762.html.
How to reproduce:
% ffmpeg -i rtsp://user:pass@192.168.1.64/Streaming/Channels/1 -c copy /tmp/test3.mp4
ffmpeg version 4.1.3-4154f89 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' --enable-bzlib --enable-libdrm --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-libkvazaar --enable-nvenc --extra-cflags=-I/usr/include/nvenc --enable-openal --enable-opencl --enable-libopenh264 --enable-libmysofa --enable-libshine --enable-libzvbi --enable-libvidstab --enable-libvmaf --enable-version3 --enable-libaom --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --enable-decoder=libdav1d --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[hevc @ 0x5602f1ee0f80] VPS 0 does not exist
Last message repeated 1 times
Input #0, rtsp, from 'rtsp://user:pass@192.168.1.64/Streaming/Channels/1':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.040000, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuv420p(tv), 2560x1440, 50 fps, 25 tbr, 90k tbn, 50 tbc
Output #0, mp4, to '/tmp/test3.mp4':
Metadata:
title : Media Presentation
encoder : Lavf58.20.100
Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv), 2560x1440, q=2-31, 50 fps, 25 tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x5602f1f14600] 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
[mp4 @ 0x5602f1f14600] 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= 167 fps= 29 q=-1.0 Lsize= 11434kB time=00:00:06.60 bitrate=14191.4kbits/s speed=1.14x
video:11432kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.015932%
Exiting normally, received signal 2.
% ffprobe /tmp/test3.mp4
ffprobe version 4.1.3-4154f89 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 9 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' --enable-bzlib --enable-libdrm --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-libkvazaar --enable-nvenc --extra-cflags=-I/usr/include/nvenc --enable-openal --enable-opencl --enable-libopenh264 --enable-libmysofa --enable-libshine --enable-libzvbi --enable-libvidstab --enable-libvmaf --enable-version3 --enable-libaom --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --enable-decoder=libdav1d --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[AVBSFContext @ 0x55f87e9a1f00] No start code is found.
/tmp/test3.mp4: Invalid data found when processing input
Test with 4.1.3, as well as bb11584924d6190a9028cbb319891028f44856a9.
Attachments (3)
Change History (4)
by , 7 years ago
| Attachment: | test.mp4.log added |
|---|
comment:1 by , 7 years ago
I have uploaded the mp4/ts files using the videolan file uploader (https://streams.videolan.org/upload/#)



Debug log from ffmpeg run producing "test.mp4"