[FFmpeg-user] IP Camera Stream "Conversion failed!" from newer ffmpeg instance, but not from older?

Steven Kan steven at kan.org
Sun Nov 7 21:40:32 EET 2021


Scroll way down . . . .

> On Nov 7, 2021, at 11:01 AM, Leo Butler <leo.butler81 at googlemail.com> wrote:
> 
> Steven Kan <steven at kan.org> writes:
> 
>> I normally stream my IP cameras to YouTube from my RPi. I just got my spiffy new (used) M1-based Mac mini, so I’m trying to move my streams over there so I can use the extra horsepower to stream 2-up from 2 cameras into one stream. 
>> 
>> But first I want to just duplicate what I’m doing on the RPi before I break it ;-)
>> 
>> I copied the exact same ffmpeg command:
>> 
>> ./ffmpeg -thread_queue_size 1024 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.50:554" -vcodec copy -acodec copy -t 01:47:02 -f flv "rtmp://a.rtmp.youtube.com/live2/<my-youtube-streaming-key>"
>> 
>> over from my RPi to my Mini, and it fails with "Conversion failed!”. Ordinarily I’d be inclined to update my software, but the version that works on my RPi is _older_ than the one on the M1 Mini that fails.
>> 
>> Do I need to add a missing library?
>> 
>> Thanks!
>> 
>> Working command from RPi:
>> 
>> ./ffmpeg -thread_queue_size 1024 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.50:554" -vcodec copy -acodec copy -t 01:47:02 -f flv "rtmp://a.rtmp.youtube.com/live2/<my-youtube-streaming-key>"
>> ffmpeg version N-89882-g4dbae00bac Copyright (c) 2000-2018 the FFmpeg developers
>>  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
>>  configuration: 
>>  libavutil      56.  7.100 / 56.  7.100
>>  libavcodec     58.  9.100 / 58.  9.100
>>  libavformat    58.  5.101 / 58.  5.101
>>  libavdevice    58.  0.101 / 58.  0.101
>>  libavfilter     7. 11.101 /  7. 11.101
>>  libswscale      5.  0.101 /  5.  0.101
>>  libswresample   3.  0.101 /  3.  0.101
>> Input #0, rtsp, from 'rtsp://anonymous:password@192.168.1.50:554':
>>  Metadata:
>>    title           : Media Server
>>  Duration: N/A, start: 0.100000, bitrate: N/A
>>    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 100 tbr, 90k tbn, 180k tbc
>>    Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp
>> Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/<my-youtube-streaming-key>':
>>  Metadata:
>>    title           : Media Server
>>    encoder         : Lavf58.5.101
>>    Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 100 tbr, 1k tbn, 90k tbc
>>    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 8000 Hz, mono, fltp
>> Stream mapping:
>>  Stream #0:0 -> #0:0 (copy)
>>  Stream #0:1 -> #0:1 (copy)
>> Press [q] to stop, [?] for help
>> [flv @ 0x1a0ac60] 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
>> [flv @ 0x1a0ac60] Failed to update header with correct duration.ate=4149.8kbits/s speed=1.36x    
>> [flv @ 0x1a0ac60] Failed to update header with correct filesize.
>> frame=  152 fps= 41 q=-1.0 Lsize=    2546kB time=00:00:05.03 bitrate=4140.5kbits/s speed=1.36x    
>> video:2532kB audio:10kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.158674%
>> 
>> Failing command from M1 mini:
>> 
>> ./ffmpeg -thread_queue_size 1024 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.50:554" -vcodec copy -acodec copy -t 01:47:02 -f flv "rtmp://a.rtmp.youtube.com/live2/<my-youtube-streaming-key>"
>> ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
>>  built with Apple clang version 12.0.0 (clang-1200.0.32.27)
>>  configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-videotoolbox --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-version3 --pkg-config-flags=--static --disable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
>>  libavutil      56. 70.100 / 56. 70.100
>>  libavcodec     58.134.100 / 58.134.100
>>  libavformat    58. 76.100 / 58. 76.100
>>  libavdevice    58. 13.100 / 58. 13.100
>>  libavfilter     7.110.100 /  7.110.100
>>  libswscale      5.  9.100 /  5.  9.100
>>  libswresample   3.  9.100 /  3.  9.100
>>  libpostproc    55.  9.100 / 55.  9.100
>> Input #0, rtsp, from 'rtsp://anonymous:password@192.168.1.50:554':
>>  Metadata:
>>    title           : Media Server
>>  Duration: N/A, start: 0.070000, bitrate: N/A
>>  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 100 tbr, 90k tbn, 180k tbc
>>  Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp
>> Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/<my-youtube-streaming-key>':
>>  Metadata:
>>    title           : Media Server
>>    encoder         : Lavf58.76.100
>>  Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 100 tbr, 1k tbn, 90k tbc
>>  Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 8000 Hz, mono, fltp
>> Stream mapping:
>>  Stream #0:0 -> #0:0 (copy)
>>  Stream #0:1 -> #0:1 (copy)
>> Press [q] to stop, [?] for help
>> [flv @ 0x13187d800] 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
>> [flv @ 0x13187d800] Packet is missing PTS
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> 
> It looks like you may need to use the setpts filter.
> 
> https://ffmpeg.org/ffmpeg-all.html#toc-Examples-187
> 
> Leo
> 
>> av_interleaved_write_frame(): Invalid argument
>> [flv @ 0x13187d800] Failed to update header with correct duration.
>> [flv @ 0x13187d800] Failed to update header with correct filesize.
>> frame=    2 fps=0.0 q=-1.0 Lsize=      17kB time=00:00:00.05 bitrate=2365.7kbits/s speed=3.03x    
>> video:86kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
>> Conversion failed!

Thanks! I fiddled with this some more, and it looks like the critical error is actually this one:

av_interleaved_write_frame(): Invalid argument

If I take my original command and change “-vcodec copy” to “-vcodec h264_videotoolbox” then the camera streams properly. I still get timing errors of the form, "Invalid DTS: 9460 PTS: 9440 in output stream 0:0, replacing by guess”, but it still works.

I can now move onto the next phase of my experiment/project, which is to assemble 2 streams into a 2-Up stream.


More information about the ffmpeg-user mailing list