[FFmpeg-user] pcm_alaw audio from Wyze Cam to YouTube?
Steven Kan
steven at kan.org
Sun Apr 19 21:13:52 EEST 2020
I’m attempting to adapt my BeeCam stack to run an OwlCam, but this requires using a very low-power, WiFi-based camera because it will all need to be solar powered and battery-backed. So I’m testing a $25 Wyze camera, using their unsupported RTSP firmware, pulling it from the camera and pushing it out to YouTube via ffmpeg running on a Raspberry Pi 3.
If I use a playlist of MP3s, stored on the Pi, it works fine:
./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.22/live" -f concat -safe 0 -i playlist.txt -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
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://anonymous:password@192.168.1.22/live':
Metadata:
title : Session streamed by "wyze"
comment : live
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
[mp3 @ 0x22af430] Estimating duration from bitrate, this may be inaccurate
Input #1, concat, from 'playlist.txt':
Duration: N/A, start: 0.000000, bitrate: 320 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key':
Metadata:
title : Session streamed by "wyze"
comment : live
encoder : Lavf58.5.101
Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 15 fps, 15 tbr, 1k tbn, 90k tbc
Stream #0:1: Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 320 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1020 fps= 13 q=-1.0 size= 15007kB time=00:01:07.94 bitrate=1809.4kbits/s speed=0.886x
If I delete the playlist, and leave -acodec at “copy”, ffmpeg happily reports an input stream in pcm_alaw fomat:
./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.22/live" -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
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://anonymous:password@192.168.1.22/live':
Metadata:
title : Session streamed by "wyze"
comment : live
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key':
Metadata:
title : Session streamed by "wyze"
comment : live
encoder : Lavf58.5.101
Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 15 fps, 15 tbr, 1k tbn, 90k tbc
Stream #0:1: Audio: pcm_alaw ([7][0][0][0] / 0x0007), 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 50 fps=8.2 q=-1.0 size= 567kB time=00:00:08.67 bitrate= 535.7kbits/s speed=1.43x
but YouTube complains that the incoming audio format is unsupported, and that I should use aac or mp3. Since ffmpeg doesn’t include an mp3 encoder by default, I tried aac, but now ffmpeg complains of "Non-monotonous DTS in output stream . . . “ and "Queue input is backward in time” and YouTube doesn’t present it.
./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.22/live" -acodec aac -vcodec 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
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://anonymous:password@192.168.1.22/live':
Metadata:
title : Session streamed by "wyze"
comment : live
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x25ee600] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key':
Metadata:
title : Session streamed by "wyze"
comment : live
encoder : Lavf58.5.101
Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 15 fps, 15 tbr, 1k tbn, 90k tbc
Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 8000 Hz, mono, fltp, 48 kb/s
Metadata:
encoder : Lavc58.9.100 aac
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:0; previous: 400, current: 67; changing to 400. This may result in incorrect timestamps in the output file.
[aac @ 0x25ee600] Queue input is backward in time
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:0; previous: 400, current: 133; changing to 400. This may result in incorrect timestamps in the output file.
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:0; previous: 400, current: 200; changing to 400. This may result in incorrect timestamps in the output file.
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:0; previous: 400, current: 267; changing to 400. This may result in incorrect timestamps in the output file.
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:0; previous: 400, current: 333; changing to 400. This may result in incorrect timestamps in the output file.
[aac @ 0x25ee600] Queue input is backward in time
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:1; previous: 128, current: 76; changing to 128. This may result in incorrect timestamps in the output file.
[aac @ 0x25ee600] Queue input is backward in time
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:1; previous: 128, current: 23; changing to 128. This may result in incorrect timestamps in the output file.
[aac @ 0x25ee600] Queue input is backward in time0:00:01.06 bitrate= 26.9kbits/s speed=1.06x
[flv @ 0x279b890] Non-monotonous DTS in output stream 0:1; previous: 572, current: 519; changing to 572. This may result in incorrect timestamps in the output file.
[aac @ 0x25ee600] Queue input is backward in time
Am I missing a flag somewhere to get aac to work? Thanks!
More information about the ffmpeg-user
mailing list