massej / RadioHLSConverter.backend.serverless

RadioHLSConverter.backend.serverless
GNU General Public License v3.0
7 stars 2 forks source link

Check if 'FFMPEG' is Installed #9

Closed LIPDProductionsInc closed 1 month ago

LIPDProductionsInc commented 1 month ago

I'm getting this error sometimes when trying to run the exe file:

Error, "ffmpeg" throw an exception, please check if "ffmpeg" is installed or inside "ffmpeg-binaries" folder and check your appsettings.json configuration!
      ffmpeg exited with non-zero exit-code (1 - ffmpeg version n6.0-26-g3f345ebf21-20230704 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --disable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230704
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
\\.\pipe\6c2bde54-4d5f-4cc1-af23-9dee1514641b: Invalid data found when processing input)
         at FFMpegCore.FFMpegArgumentProcessor.HandleCompletion(Boolean throwOnError, Int32 exitCode, IReadOnlyList'1 errorData)
         at FFMpegCore.FFMpegArgumentProcessor.ProcessAsynchronously(Boolean throwOnError, FFOptions ffMpegOptions)
         at RadioHLSConverter.backend.serverless.Services.FFMpegConverterService.<>c__DisplayClass11_0.<<Init_FFMpeg>b__0>d.MoveNext() in F:\Documents\Project-Delphi\RadioHLSConverter.backend.serverless\RadioHLSConverter.backend.serverless\Services\FFMpegConverterService.cs:line 96

Is this a me issue?

massej commented 1 month ago

Can you attach your config file? I will check and see what is happening

LIPDProductionsInc commented 1 month ago
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Information",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "AppSettings": {
    "ForceHTTPS": false,
    "FFMpegPipeBufferInBytes": 131072,
    "BufferSizeInSeconds": 30,
    "Radios": [
      {
        "RadioName": "WXBK-HD2 | 94.7 FM | New York's Country",
        "RadioDescription": "Today's New Country. WXBK-HD2 is spinning the best Country music, live from New York.",
        "RadioSourceURL": "https://live.amperwave.net/manifest/audacy-wxbkhd2aac-hlsc.m3u8",
        "HTTPContentType": "audio/mp3",
        "FFMPEGConverterAudioCodec": "mp3",
        "FFMPEGForceFormat": "mp3",
        "FFMPEGCustomArgument": ""
      }
    ]
  }
}
massej commented 1 month ago

Thank you for the report

I replicated the issue

The issue is when there is a message of the day on connect, the radio is using a different stream for this message and it cause ffmpeg an error (due to the the fact there are two differents stream)

i’m working on a fix

massej commented 1 month ago

I just released version 1.0.18, it should fix the issue.

Take note that you must now have .NET 8.0 installed.

Best regards,

LIPDProductionsInc commented 1 month ago

This is still happening

LIPDProductionsInc commented 1 month ago

@massej

LIPDProductionsInc commented 1 month ago

Different log though:

Error, "ffmpeg" throw an exception, please check if "ffmpeg" is installed or inside "ffmpeg-binaries" folder and check your appsettings.json configuration!
      ffmpeg exited with non-zero exit-code (-1094995529 - ffmpeg version n7.0.2-6-g7e69129d2f-20240817 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (crosstool-NG 1.26.0.106_ed12fa6)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240817
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[in#0 @ 000001a8e0979f00] Error opening input: Invalid data found when processing input
Error opening input file \\.\pipe\d6cf9c66-e76c-40ae-b0b9-10efc42c41b6.
Error opening input files: Invalid data found when processing input)
         at FFMpegCore.FFMpegArgumentProcessor.HandleCompletion(Boolean throwOnError, Int32 exitCode, IReadOnlyList`1 errorData)
         at FFMpegCore.FFMpegArgumentProcessor.ProcessAsynchronously(Boolean throwOnError, FFOptions ffMpegOptions)
         at RadioHLSConverter.backend.serverless.Services.FFMpegConverterService.<>c__DisplayClass11_0.<<Init_FFMpeg>b__0>d.MoveNext() in F:\Documents\Project-Delphi\RadioHLSConverter.backend.serverless\RadioHLSConverter.backend.serverless\Services\FFMpegConverterService.cs:line 96
massej commented 1 month ago

Is the issue only happen when you connect the first time on the radio?

LIPDProductionsInc commented 1 month ago

No, it happens randomly. Sometimes it works fine, sometimes it stops working after a while, other times I have restart it again and again until it works

LIPDProductionsInc commented 1 month ago

There's also this

Error, "ffmpeg" throw an exception, please check if "ffmpeg" is installed or inside "ffmpeg-binaries" folder and check your appsettings.json configuration!
      ffmpeg exited with non-zero exit-code (-22 - ffmpeg version n7.0.2-6-g7e69129d2f-20240817 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14.2.0 (crosstool-NG 1.26.0.106_ed12fa6)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240817
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, aac, from '\\.\pipe\fac5dc19-f2df-4cc1-921d-f2571f2e7624':
  Metadata:
    artist          : Lee Brice
    title           : Hard To Love
    comment         : {"frag_type":"content"}
    id3v2_priv.amperwave.metadata: {"duration":"197","albumArtUrl":"https://enrichment.amperwave.net/image/0/Lee Brice/Hard To Love/large","title":"Hard To Love","artist":"Lee Brice","type":"content"}
    id3v2_priv.com.apple.streaming.transportStreamTimestamp: \x00\x00\x00\x00\x18\x0e\xb9\x02
  Duration: N/A, bitrate: 127 kb/s
  Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 127 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to '\\.\pipe\7a12bce2-865d-4e07-aaf4-6c4af566a160':
  Metadata:
    TPE1            : Lee Brice
    TIT2            : Hard To Love
    comment         : {"frag_type":"content"}
    id3v2_priv.amperwave.metadata: {"duration":"197","albumArtUrl":"https://enrichment.amperwave.net/image/0/Lee Brice/Hard To Love/large","title":"Hard To Love","artist":"Lee Brice","type":"content"}
    id3v2_priv.com.apple.streaming.transportStreamTimestamp: \x00\x00\x00\x00\x18\x0e\xb9\x02
    TSSE            : Lavf61.1.100
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp
      Metadata:
        encoder         : Lavc61.3.100 libmp3lame
size=     821KiB time=00:00:52.50 bitrate= 128.1kbits/s speed=99.8x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=55.1x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=36.7x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=27.6x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=  22x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=18.3x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=15.7x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=13.8x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=12.3x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=  11x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=  10x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed= 9.2x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=8.48x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=7.89x
size=     892KiB time=00:00:57.05 bitrate= 128.1kbits/s speed=7.36x
...
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.09x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.09x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.09x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.09x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.09x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.08x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.07x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.07x
size=   10339KiB time=00:11:01.68 bitrate= 128.0kbits/s speed=1.07x
[aost#0:0/libmp3lame @ 000001d281ed7bc0] Error submitting a packet to the muxer: Invalid argument
    Last message repeated 1 times
[out#0/mp3 @ 000001d281ea7b80] Error muxing a packet
[out#0/mp3 @ 000001d281ea7b80] Task finished with error code: -22 (Invalid argument)
[out#0/mp3 @ 000001d281ea7b80] Terminating thread with return code -22 (Invalid argument)
[out#0/mp3 @ 000001d281ea7b80] Error writing trailer: Invalid argument
[out#0/mp3 @ 000001d281ea7b80] Error closing file: Invalid argument
[out#0/mp3 @ 000001d281ea7b80] video:0KiB audio:10340KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
size=   10340KiB time=00:11:01.70 bitrate= 128.0kbits/s speed=1.07x
Conversion failed!)
         at FFMpegCore.FFMpegArgumentProcessor.HandleCompletion(Boolean throwOnError, Int32 exitCode, IReadOnlyList`1 errorData)
         at FFMpegCore.FFMpegArgumentProcessor.ProcessAsynchronously(Boolean throwOnError, FFOptions ffMpegOptions)
         at RadioHLSConverter.backend.serverless.Services.FFMpegConverterService.<>c__DisplayClass11_0.<<Init_FFMpeg>b__0>d.MoveNext() in F:\Documents\Project-Delphi\RadioHLSConverter.backend.serverless\RadioHLSConverter.backend.serverless\Services\FFMpegConverterService.cs:line 96
massej commented 1 month ago

Thanks for sharing all the info @LIPDProductionsInc

I just released version 1.0.19 which fix one but it seems you have 2 issues. I will leave the radio on my computer for a few hours and see if I get any message / error.

The last one that you sent me I think it's because the mp3 encoder won't support the metadata, I will do some more testing.

There are two things you can also try :

  1. If you want to keep the best audio quality (the radio is transmitting using aac so you can keep the same using adts) so it will avoid to convert the aac from the radio to mp3.

    { "RadioName": "WXBK-HD2 | 94.7 FM | New York's Country", "RadioDescription": "Today's New Country. WXBK-HD2 is spinning the best Country music, live from New York.", "RadioSourceURL": "https://live.amperwave.net/manifest/audacy-wxbkhd2aac-hlsc.m3u8", "HTTPContentType": "audio/aac", "FFMPEGConverterAudioCodec": "copy", "FFMPEGForceFormat": "adts", "FFMPEGCustomArgument": "" },

Note : Doing this will disable the ability to have the metadata (adts won't support metadata unfortunately)

  1. If you are using mp3, you can disable the metadata setting "FFMPEGCustomArgument" to "-map_metadata -1". (If the metadata is the issue it should also fix the issue)
massej commented 1 month ago

Still playing, 2h30 without issue.

I think it 1.0.19 fixed all issues

I'm using (mp3 with metadata)

  {
    "RadioName": "WXBK-HD2 | 94.7 FM | New York's Country",
    "RadioDescription": "Today's New Country. WXBK-HD2 is spinning the best Country music, live from New York.",
    "RadioSourceURL": "https://live.amperwave.net/manifest/audacy-wxbkhd2aac-hlsc.m3u8",
    "HTTPContentType": "audio/mp3",
    "FFMPEGConverterAudioCodec": "mp3",
    "FFMPEGForceFormat": "mp3",
    "FFMPEGCustomArgument": ""
  }
massej commented 1 month ago

Still playing without any issues after 20 hours.