just few tips that may help u :
- use a newer ffmpeg version, 3-4 year old versions may give u trouble
- take tote on time, a quick way to find correct timestamp use https://www.epochconverter.com/ , use the fitst tool"human date to tiemstamp" using local time
- empty playlists/shorter vids mean that your timestamps are wrong or the recorded time requested is missing,
- the aac_adtstoasc-codec as listed above may give u errors depending on the source quality, on some rtmp inputs works on some mpeg ones fails so i found this little gem : h264_mp4toannexb
full code that resolved all my problems (-quit helps not displaying all those non important errors, used it only after you are sure your code works) :
ffmpeg -v quiet -i http://127.0.0.1:8081/path/stream/playlist_dvr_range-1516013940-7400.m3u8 -vcodec copy -vbsf h264_mp4toannexb -acodec copy /outputpath/output.mp4
thanks