0

I have one line of code here but seemingly there is an audio issue. My camera streams h265 video and g726 audio. Would highly appreciate it if somebody could advise please, how do I fix / convert g726 audio so that it could be streamed flawlessly via hls? Many thanks in advance!

 ffmpeg -rtsp_transport tcp -i rtsp://login:password@1.1.1.1:554/11 -map 0 - 
c:v libx265 -vb 300k -c:a aac -ab 38k -ar 44100 -preset veryfast -f segment - 
segment_list /usr/local/nginx/html/hls/mystream.m3u8 -segment_list_type hls - 
segment_list_size 10 -segment_list_flags +live -segment_time 10 -segment_wrap 
30 /usr/local/nginx/html/hls/mystream%01d.ts

The log loos like this:

ffmpeg version 4.1.4-1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
 built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  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
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://login:password@1.1.1.1:554/11':
  Metadata:
    title           : 10
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 1920x1080, 14.99 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 0x56362603ca40] deprecated pixel format used, make sure you did set range correctly
x265 [info]: HEVC encoder version 2.9
x265 [info]: build info [Linux][GCC 8.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2 SSE3 Cache64
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 1 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 14 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 15 / 4 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 2 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-300 kbps / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip rskip signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream0.ts' for writing
Output #0, segment, to '/usr/local/nginx/html/hls/mystream%01d.ts':
  Metadata:
    title           : 10
    encoder         : Lavf58.20.100
    Stream #0:0: Video: hevc (libx265), yuv420p, 1920x1080, q=2-31, 300 kb/s, 14.99 fps, 90k tbn, 14.99 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx265
    Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp, 38 kb/s
    Metadata:
      encoder         : Lavc58.35.100 aac
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream1.ts' for writing
[rtsp @ 0x563625cecdc0] CSeq 10 expected, 7 received.bitrate=N/A dup=151 drop=0 speed=0.255x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream2.ts' for writing
[rtsp @ 0x563625cecdc0] CSeq 11 expected, 8 received.bitrate=N/A dup=188 drop=0 speed=0.251x
[hevc @ 0x563625d0a780] Could not find ref with POC 30itrate=N/A dup=221 drop=0 speed=0.253x
[rtsp @ 0x563625cecdc0] CSeq 12 expected, 9 received.bitrate=N/A dup=264 drop=0 speed=0.244x
[hevc @ 0x563625d95900] Could not find ref with POC 35itrate=N/A dup=269 drop=0 speed=0.243x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream3.ts' for writing
[hevc @ 0x563625d10680] Could not find ref with POC 0bitrate=N/A dup=370 drop=0 speed=0.248x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream4.ts' for writing
[hevc @ 0x563625d0a780] Could not find ref with POC 29itrate=N/A dup=380 drop=0 speed=0.247x
[hevc @ 0x563625d0a780] Could not find ref with POC 20itrate=N/A dup=471 drop=0 speed=0.252x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream5.ts' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream6.ts' for writing
[hevc @ 0x563625d95900] Could not find ref with POC 0bitrate=N/A dup=551 drop=0 speed=0.254x
[hevc @ 0x563625d10680] Could not find ref with POC 22itrate=N/A dup=552 drop=0 speed=0.254x
[hevc @ 0x563625d95900] Could not find ref with POC 0bitrate=N/A dup=653 drop=0 speed=0.259x
[rtsp @ 0x563625cecdc0] CSeq 15 expected, 10 received.itrate=N/A dup=657 drop=0 speed=0.258x
[hevc @ 0x563625d10680] Duplicate POC in a sequence: 37.rate=N/A dup=673 drop=0 speed=0.257x
[hevc @ 0x563625d10680] Error parsing NAL unit #0.
Error while decoding stream #0:0: Invalid data found when processing inputrop=0 speed=0.257x
[hevc @ 0x563625d95900] Could not find ref with POC 8bitrate=N/A dup=735 drop=0 speed=0.258x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream7.ts' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream8.ts' for writing
[hevc @ 0x563625d10680] Could not find ref with POC 0bitrate=N/A dup=881 drop=0 speed=0.26x
[hevc @ 0x563625d10680] Could not find ref with POC 33itrate=N/A dup=883 drop=0 speed=0.26x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream9.ts' for writing
[hevc @ 0x563625d10680] Could not find ref with POC 0bitrate=N/A dup=932 drop=0 speed=0.26x
[rtsp @ 0x563625cecdc0] CSeq 18 expected, 11 received.itrate=N/A dup=945 drop=0 speed=0.259x
[hevc @ 0x563625d10680] Could not find ref with POC 2bitrate=N/A dup=952 drop=0 speed=0.259x
More than 1000 frames duplicatedN/A time=00:01:46.50 bitrate=N/A dup=958 drop=0 speed=0.259x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream10.ts' for writing
[hevc @ 0x563625d0a780] Could not find ref with POC 0bitrate=N/A dup=1039 drop=0 speed=0.26x
[hevc @ 0x563625d0a780] Could not find ref with POC 5bitrate=N/A dup=1045 drop=0 speed=0.26x
[hevc @ 0x563625d10680] Could not find ref with POC 37itrate=N/A dup=1109 drop=0 speed=0.26x
[hevc @ 0x563625d95900] Could not find ref with POC 0bitrate=N/A dup=1110 drop=0 speed=0.26x
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream11.ts' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writingx
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream12.ts' for writing
[segment @ 0x563625d00b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
frame= 1967 fps=3.9 q=-0.0 Lsize=N/A time=00:02:11.06 bitrate=N/A dup=1206 drop=0 speed=0.261x
video:4430kB audio:368kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: unknown
x265 [info]: frame I:     16, Avg QP:25.68  kb/s: 6561.13
x265 [info]: frame P:    391, Avg QP:29.36  kb/s: 966.96
x265 [info]: frame B:   1560, Avg QP:37.01  kb/s: 38.34
x265 [info]: Weighted P-Frames: Y:1.5% UV:1.3%
x265 [info]: consecutive B-frames: 3.2% 0.2% 0.5% 2.2% 93.9%

encoded 1967 frames in 502.62s (3.91 fps), 275.99 kb/s, Avg QP:35.40
[aac @ 0x563625d01a40] Qavg: 129.821
  • Not sure what the actual issue is here. ffmpeg can decode G.726 and -c:a aac should work for HLS. – llogan Nov 8 at 18:28
  • but it always stops at 120 frames maximum without reporting any errors or anything. It stops and says this, encoded 64 frames in 14.93s (4.29 fps), 869.28 kb/s, Avg QP:50.01 [aac @ 0x55a9929450c0] Qavg: 838.802 – Dennis Nov 8 at 19:01
  • Show the full log. – llogan Nov 8 at 19:06
  • How? It's running on my Linux Debian 10 VPS (KVM) with nginx and there are no logs anywhere. I have searched high and low but I cannot seem to find any. – Dennis Nov 8 at 23:40
  • When you run the command the "log" will appear in the terminal. Alternatively, add the -report option and it will output a very verbose log file in the current directory. – llogan Nov 9 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.