user26716: Is it possible at all to convert G.711 audio to AAC audio in a stream using ffmpeg? My cam is streaming fine in Chrome (video + audio) but all the other browsers have no audio. I would appreciate any help / input / suggestions / comments at all. Many thanks in advance!
Here is the code:
ffmpeg -rtsp_transport tcp -i rtsp://login:password@1.1.1.1:554/11 -map 0 -c:v copy -c:a copy -f 
segment -segment_list /usr/local/nginx/html/hls/mystream.m3u8 -segment_list_type hls - 
segment_list_size 10 -segment_list_flags +live /usr/local/nginx/html/hls/mystream%01d.ts

I have of course tried putting -c:a aac there before but it does not help.
There are millions of online tutorials and examples on how to convert a file. But it's not a file in my case it's a live stream. Am I missing something here? Do I perhaps somehow have to convert my final output file called mystream.m3u8?
P.S. Currently my cam is streaming in libx264 for video and G.711 for audio, but I can easily change it to stream in libx265 for video and G.726 for audio should that be of any help to play both video + audio. These are the only two options available in my camera and I cannot set it to anything else.
P.S.S. Here's the copy-pasted log, Gyan. I am not sure if that helps though. I do not see anything unusual there. Can you tell what is wrong?
ffmpeg started on 2020-04-08 at 04:54:52
Report written to "ffmpeg-20200408-045452.log"
Command line:
ffmpeg -rtsp_transport tcp -i rtsp://login:pass@1.1.1.1:1/111 -map 0 -c:v copy -c:a aac -f segment -segment_list /usr/local/nginx/html/hls/mystream.m3u8 -segment_list_type hls -segment_list_size 10 -segment_list_flags +live "/usr/local/nginx/html/hls/mystream%01d.ts" -loglevel verbose -report -t 30
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 --en  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
Splitting the commandline.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input url with argument 'rtsp://login:pass@1.1.1.1:554/111'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'segment'.
Reading option '-segment_list' ... matched as AVOption 'segment_list' with argument '/usr/local/nginx/html/hls/mystream.m3u8'.
Reading option '-segment_list_type' ... matched as AVOption 'segment_list_type' with argument 'hls'.
Reading option '-segment_list_size' ... matched as AVOption 'segment_list_size' with argument '10'.
Reading option '-segment_list_flags' ... matched as AVOption 'segment_list_flags' with argument '+live'.
Reading option '/usr/local/nginx/html/hls/mystream%01d.ts' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'verbose'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '30'.
Trailing options were found on the commandline.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument verbose.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://login:pass@1.1.1.1:554/111.
Successfully parsed a group of options.
Opening an input file: rtsp://login:pass@1.1.1.1:554/111.
[tcp @ 0x564b593fe780] No default whitelist set
[tcp @ 0x564b593fe780] Original list of addresses:
[tcp @ 0x564b593fe780] Address 8.2.1.11 port 554
[tcp @ 0x564b593fe780] Interleaved list of addresses:
[tcp @ 0x564b593fe780] Address 8.2.1.1 port 554
[tcp @ 0x564b593fe780] Starting connection attempt to 8.2.1.1 port 554
[tcp @ 0x564b593fe780] Successfully connected to 8.2.1.1 port 554
[rtsp @ 0x564b593fc540] SDP:
v=0
o=StreamingServer 3331435948 1116907222000 IN IP4 192.168.0.199
s=10
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 96
a=control:trackID=0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42002A;sprop-parameter-sets=Z0IAKpY1QPAET8s3AQEBAg==,aM48gA==
a=framesize:96 1920-1080
m=audio 0 RTP/AVP 8
a=control:trackID=1
a=rtpmap:8 PCMA/8000/1
a=ptime:20
a=fmtp:8 packetization-mode=1

[rtsp @ 0x564b593fc540] video codec set to: h264
[rtsp @ 0x564b593fc540] RTP Packetization Mode: 1
[rtsp @ 0x564b593fc540] RTP Profile IDC: 42 Profile IOP: 0 Level: 2a
[rtsp @ 0x564b593fc540] Extradata set to 0x564b594005f0 (size: 28)
[rtsp @ 0x564b593fc540] audio codec set to: pcm_alaw
[rtsp @ 0x564b593fc540] audio samplerate set to: 8000
[rtsp @ 0x564b593fc540] audio channels set to: 1
[rtsp @ 0x564b593fc540] setting jitter buffer size to 0
[rtsp @ 0x564b593fc540] setting jitter buffer size to 0
[rtsp @ 0x564b593fc540] hello state=0
[h264 @ 0x564b59400100] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] unknown SEI type 229
[h264 @ 0x564b59400100] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x564b59400100] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x564b59400100] unknown SEI type 229
[h264 @ 0x564b59400100] Format yuvj420p chosen by get_format().
[h264 @ 0x564b59400100] Reinit context to 1920x1088, pix_fmt: yuvj420p
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[rtsp @ 0x564b593fc540] All info found
[rtsp @ 0x564b593fc540] rfps: 29.500000 0.018596
[rtsp @ 0x564b593fc540] rfps: 29.583333 0.012613
[rtsp @ 0x564b593fc540] rfps: 29.666667 0.007793
[rtsp @ 0x564b593fc540] rfps: 29.666667 0.007793
[rtsp @ 0x564b593fc540] rfps: 29.750000 0.004137
[rtsp @ 0x564b593fc540] rfps: 29.750000 0.004137
[rtsp @ 0x564b593fc540] rfps: 29.833333 0.001644
[rtsp @ 0x564b593fc540] rfps: 29.833333 0.001644
[rtsp @ 0x564b593fc540] rfps: 29.916667 0.000314
[rtsp @ 0x564b593fc540] rfps: 29.916667 0.000314
[rtsp @ 0x564b593fc540] rfps: 30.000000 0.000149
[rtsp @ 0x564b593fc540] rfps: 60.000000 0.000595
[rtsp @ 0x564b593fc540] rfps: 120.000000 0.002380
[rtsp @ 0x564b593fc540] rfps: 240.000000 0.009520
[rtsp @ 0x564b593fc540] rfps: 29.970030 0.000074
[rtsp @ 0x564b593fc540] rfps: 59.940060 0.000297
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://login:pass@1.1.1.1:554/111':
  Metadata:
    title           : 10
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 28, 1/90000: Video: h264 (Baseline), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088), 29.97 tbr, 90k tbn, 180k tbc
    Stream #0:1, 72, 1/8000: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Successfully opened the file.
Parsing a group of options: output url /usr/local/nginx/html/hls/mystream%01d.ts.
Applying option map (set input stream mapping) with argument 0.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument aac.
Applying option f (force format) with argument segment.
Successfully parsed a group of options.
Opening an output file: /usr/local/nginx/html/hls/mystream%01d.ts.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
detected 2 logical cores
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'time_base' to value '1/8000'
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'sample_rate' to value '8000'
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_1 @ 0x564b59439cc0] tb:1/8000 samplefmt:s16 samplerate:8000 chlayout:0x4
[format_out_0_1 @ 0x564b5943b040] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x564b5943b040] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_1 @ 0x564b5943b040] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x564b5941e880] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x564b5957eb40] [SWR @ 0x564b59507740] Using s16p internally between filters
[auto_resampler_0 @ 0x564b5957eb40] ch:1 chl:mono fmt:s16 r:8000Hz -> ch:1 chl:mono fmt:fltp r:8000Hz
[aac @ 0x564b594200c0] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
[segment @ 0x564b59403b80] Selected stream id:0 type:video
[segment @ 0x564b59403b80] Opening '/usr/local/nginx/html/hls/mystream0.ts' for writing
[file @ 0x564b59580b40] Setting default whitelist 'file,crypto'
[mpegts @ 0x564b59580480] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, segment, to '/usr/local/nginx/html/hls/mystream%01d.ts':
  Metadata:
    title           : 10
    encoder         : Lavf58.20.100
    Stream #0:0, 0, 1/90000: Video: h264 (Baseline), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 29.97 tbr, 90k tbn, 90k tbc
    Stream #0:1, 0, 1/90000: Audio: aac (LC), 8000 Hz, mono, fltp, delay 1024, 48 kb/s
    Metadata:
      encoder         : Lavc58.35.100 aac
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[segment @ 0x564b59403b80] 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)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream0.ts' starts with packet stream:1 pts:0 pts_time:0 frame:0
[segment @ 0x564b59403b80] stream:1 start_pts_time:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream0.ts' starts with packet stream:0 pts:11520 pts_time:0.128 frame:0
[segment @ 0x564b59403b80] stream:0 start_pts_time:0 pts:11520 pts_time:0.128 dts:11520 dts_time:0.128 -> pts:11520 pts_time:0.128 dts:11520 dts_time:0.128
[segment @ 0x564b59403b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[file @ 0x564b59530900] Setting default whitelist 'file,crypto'
[segment @ 0x564b59403b80] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x564b5959f440] Statistics: 0 seeks, 1 writeouts
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream0.ts' count:0 ended
[AVIOContext @ 0x564b59591140] Statistics: 0 seeks, 2 writeouts
[segment @ 0x564b59403b80] Opening '/usr/local/nginx/html/hls/mystream1.ts' for writing
[file @ 0x564b5959c900] Setting default whitelist 'file,crypto'
[mpegts @ 0x564b595a1280] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream1.ts' starts with packet stream:0 pts:191700 pts_time:2.13 frame:40


user26716: Let me answer my own question. My code is working fine and there was a tiny spelling mistake. Gee... silly me. However, sometimes you just have to post the question and put it all in writing in order to realize where the problem is. Now in case somebody is interested here is how the theory / syntax looks:
"-a:c copy" is to copy without transcoding when "-a:c {codec} {additional audio parameters}" is to transcode.
Now my code is streaming cross browsers perfectly well. You may want to adjust bit rates and customize it the way you see fit.
ffmpeg -rtsp_transport tcp -i rtsp://login:password@1.1.1.1:554/11 -map 0 -c:v copy - 
c:a aac -f segment -segment_list /usr/local/nginx/html/hls/mystream.m3u8 - 
segment_list_type hls - segment_list_size 10 -segment_list_flags +live 
 /usr/local/nginx/html/hls/mystream%01d.ts


26716: <p>Is it possible at all to convert G.711 audio to AAC audio in a stream using ffmpeg? My cam is streaming fine in Chrome (video + audio) but all the other browsers have no audio. I would appreciate any help / input / suggestions / comments at all. Many thanks in advance!</p>

<p>Here is the code:</p>

<pre><code>ffmpeg -rtsp_transport tcp -i rtsp://login:password@1.1.1.1:554/11 -map 0 -c:v copy -c:a copy -f 
segment -segment_list /usr/local/nginx/html/hls/mystream.m3u8 -segment_list_type hls - 
segment_list_size 10 -segment_list_flags +live /usr/local/nginx/html/hls/mystream%01d.ts
</code></pre>

<p>I have of course tried putting -c:a aac there before but it does not help.</p>

<p>There are millions of online tutorials and examples on how to convert a file. But it's not a file in my case it's a live stream. Am I missing something here? Do I perhaps somehow have to convert my final output file called mystream.m3u8?</p>

<p>P.S. Currently my cam is streaming in libx264 for video and G.711 for audio, but I can easily change it to stream in libx265 for video and G.726 for audio should that be of any help to play both video + audio. These are the only two options available in my camera and I cannot set it to anything else.</p>

<p>P.S.S. Here's the copy-pasted log, Gyan. I am not sure if that helps though. I do not see anything unusual there. Can you tell what is wrong?</p>

<pre><code>ffmpeg started on 2020-04-08 at 04:54:52
Report written to "ffmpeg-20200408-045452.log"
Command line:
ffmpeg -rtsp_transport tcp -i rtsp://login:pass@1.1.1.1:1/111 -map 0 -c:v copy -c:a aac -f segment -segment_list /usr/local/nginx/html/hls/mystream.m3u8 -segment_list_type hls -segment_list_size 10 -segment_list_flags +live "/usr/local/nginx/html/hls/mystream%01d.ts" -loglevel verbose -report -t 30
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 --en  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
Splitting the commandline.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input url with argument 'rtsp://login:pass@1.1.1.1:554/111'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'segment'.
Reading option '-segment_list' ... matched as AVOption 'segment_list' with argument '/usr/local/nginx/html/hls/mystream.m3u8'.
Reading option '-segment_list_type' ... matched as AVOption 'segment_list_type' with argument 'hls'.
Reading option '-segment_list_size' ... matched as AVOption 'segment_list_size' with argument '10'.
Reading option '-segment_list_flags' ... matched as AVOption 'segment_list_flags' with argument '+live'.
Reading option '/usr/local/nginx/html/hls/mystream%01d.ts' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'verbose'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '30'.
Trailing options were found on the commandline.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument verbose.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://login:pass@1.1.1.1:554/111.
Successfully parsed a group of options.
Opening an input file: rtsp://login:pass@1.1.1.1:554/111.
[tcp @ 0x564b593fe780] No default whitelist set
[tcp @ 0x564b593fe780] Original list of addresses:
[tcp @ 0x564b593fe780] Address 8.2.1.11 port 554
[tcp @ 0x564b593fe780] Interleaved list of addresses:
[tcp @ 0x564b593fe780] Address 8.2.1.1 port 554
[tcp @ 0x564b593fe780] Starting connection attempt to 8.2.1.1 port 554
[tcp @ 0x564b593fe780] Successfully connected to 8.2.1.1 port 554
[rtsp @ 0x564b593fc540] SDP:
v=0
o=StreamingServer 3331435948 1116907222000 IN IP4 192.168.0.199
s=10
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 96
a=control:trackID=0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42002A;sprop-parameter-sets=Z0IAKpY1QPAET8s3AQEBAg==,aM48gA==
a=framesize:96 1920-1080
m=audio 0 RTP/AVP 8
a=control:trackID=1
a=rtpmap:8 PCMA/8000/1
a=ptime:20
a=fmtp:8 packetization-mode=1

[rtsp @ 0x564b593fc540] video codec set to: h264
[rtsp @ 0x564b593fc540] RTP Packetization Mode: 1
[rtsp @ 0x564b593fc540] RTP Profile IDC: 42 Profile IOP: 0 Level: 2a
[rtsp @ 0x564b593fc540] Extradata set to 0x564b594005f0 (size: 28)
[rtsp @ 0x564b593fc540] audio codec set to: pcm_alaw
[rtsp @ 0x564b593fc540] audio samplerate set to: 8000
[rtsp @ 0x564b593fc540] audio channels set to: 1
[rtsp @ 0x564b593fc540] setting jitter buffer size to 0
[rtsp @ 0x564b593fc540] setting jitter buffer size to 0
[rtsp @ 0x564b593fc540] hello state=0
[h264 @ 0x564b59400100] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] unknown SEI type 229
[h264 @ 0x564b59400100] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x564b59400100] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x564b59400100] unknown SEI type 229
[h264 @ 0x564b59400100] Format yuvj420p chosen by get_format().
[h264 @ 0x564b59400100] Reinit context to 1920x1088, pix_fmt: yuvj420p
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x564b59400100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[rtsp @ 0x564b593fc540] All info found
[rtsp @ 0x564b593fc540] rfps: 29.500000 0.018596
[rtsp @ 0x564b593fc540] rfps: 29.583333 0.012613
[rtsp @ 0x564b593fc540] rfps: 29.666667 0.007793
[rtsp @ 0x564b593fc540] rfps: 29.666667 0.007793
[rtsp @ 0x564b593fc540] rfps: 29.750000 0.004137
[rtsp @ 0x564b593fc540] rfps: 29.750000 0.004137
[rtsp @ 0x564b593fc540] rfps: 29.833333 0.001644
[rtsp @ 0x564b593fc540] rfps: 29.833333 0.001644
[rtsp @ 0x564b593fc540] rfps: 29.916667 0.000314
[rtsp @ 0x564b593fc540] rfps: 29.916667 0.000314
[rtsp @ 0x564b593fc540] rfps: 30.000000 0.000149
[rtsp @ 0x564b593fc540] rfps: 60.000000 0.000595
[rtsp @ 0x564b593fc540] rfps: 120.000000 0.002380
[rtsp @ 0x564b593fc540] rfps: 240.000000 0.009520
[rtsp @ 0x564b593fc540] rfps: 29.970030 0.000074
[rtsp @ 0x564b593fc540] rfps: 59.940060 0.000297
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://login:pass@1.1.1.1:554/111':
  Metadata:
    title           : 10
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 28, 1/90000: Video: h264 (Baseline), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088), 29.97 tbr, 90k tbn, 180k tbc
    Stream #0:1, 72, 1/8000: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Successfully opened the file.
Parsing a group of options: output url /usr/local/nginx/html/hls/mystream%01d.ts.
Applying option map (set input stream mapping) with argument 0.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument aac.
Applying option f (force format) with argument segment.
Successfully parsed a group of options.
Opening an output file: /usr/local/nginx/html/hls/mystream%01d.ts.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -&gt; #0:0 (copy)
  Stream #0:1 -&gt; #0:1 (pcm_alaw (native) -&gt; aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
detected 2 logical cores
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'time_base' to value '1/8000'
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'sample_rate' to value '8000'
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_1 @ 0x564b59439cc0] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_1 @ 0x564b59439cc0] tb:1/8000 samplefmt:s16 samplerate:8000 chlayout:0x4
[format_out_0_1 @ 0x564b5943b040] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x564b5943b040] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_1 @ 0x564b5943b040] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x564b5941e880] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x564b5957eb40] [SWR @ 0x564b59507740] Using s16p internally between filters
[auto_resampler_0 @ 0x564b5957eb40] ch:1 chl:mono fmt:s16 r:8000Hz -&gt; ch:1 chl:mono fmt:fltp r:8000Hz
[aac @ 0x564b594200c0] Too many bits 8832.000000 &gt; 6144 per frame requested, clamping to max
[segment @ 0x564b59403b80] Selected stream id:0 type:video
[segment @ 0x564b59403b80] Opening '/usr/local/nginx/html/hls/mystream0.ts' for writing
[file @ 0x564b59580b40] Setting default whitelist 'file,crypto'
[mpegts @ 0x564b59580480] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, segment, to '/usr/local/nginx/html/hls/mystream%01d.ts':
  Metadata:
    title           : 10
    encoder         : Lavf58.20.100
    Stream #0:0, 0, 1/90000: Video: h264 (Baseline), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 29.97 tbr, 90k tbn, 90k tbc
    Stream #0:1, 0, 1/90000: Audio: aac (LC), 8000 Hz, mono, fltp, delay 1024, 48 kb/s
    Metadata:
      encoder         : Lavc58.35.100 aac
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[segment @ 0x564b59403b80] 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)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream0.ts' starts with packet stream:1 pts:0 pts_time:0 frame:0
[segment @ 0x564b59403b80] stream:1 start_pts_time:0 pts:0 pts_time:0 dts:0 dts_time:0 -&gt; pts:0 pts_time:0 dts:0 dts_time:0
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream0.ts' starts with packet stream:0 pts:11520 pts_time:0.128 frame:0
[segment @ 0x564b59403b80] stream:0 start_pts_time:0 pts:11520 pts_time:0.128 dts:11520 dts_time:0.128 -&gt; pts:11520 pts_time:0.128 dts:11520 dts_time:0.128
[segment @ 0x564b59403b80] Opening '/usr/local/nginx/html/hls/mystream.m3u8.tmp' for writing
[file @ 0x564b59530900] Setting default whitelist 'file,crypto'
[segment @ 0x564b59403b80] EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x564b5959f440] Statistics: 0 seeks, 1 writeouts
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream0.ts' count:0 ended
[AVIOContext @ 0x564b59591140] Statistics: 0 seeks, 2 writeouts
[segment @ 0x564b59403b80] Opening '/usr/local/nginx/html/hls/mystream1.ts' for writing
[file @ 0x564b5959c900] Setting default whitelist 'file,crypto'
[mpegts @ 0x564b595a1280] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
[segment @ 0x564b59403b80] segment:'/usr/local/nginx/html/hls/mystream1.ts' starts with packet stream:0 pts:191700 pts_time:2.13 frame:40
</code></pre>
 26716: <p>Let me answer my own question. My code is working fine and there was a tiny spelling mistake. Gee... silly me. However, sometimes you just have to post the question and put it all in writing in order to realize where the problem is. Now in case somebody is interested here is how the theory / syntax looks:</p>

<p>"-a:c copy" is to copy without transcoding when "-a:c {codec} {additional audio parameters}" is to transcode.</p>

<p>Now my code is streaming cross browsers perfectly well. You may want to adjust bit rates and customize it the way you see fit.</p>

<pre><code>ffmpeg -rtsp_transport tcp -i rtsp://login:password@1.1.1.1:554/11 -map 0 -c:v copy - 
c:a aac -f segment -segment_list /usr/local/nginx/html/hls/mystream.m3u8 - 
segment_list_type hls - segment_list_size 10 -segment_list_flags +live 
 /usr/local/nginx/html/hls/mystream%01d.ts
</code></pre>
