Jump to content
  • 0

InvocationTargetException and when launching from custom AMI


Karel
 Share

Question

I'm using Terraform Packer to create an AMI. Starting with Ubuntu 20.04.5 LTS and then running a script to install Ant Media Server (see attached). The AMI is then launched by an AWS Autoscaling Group.

When I try to publish a stream over RTMP, there's always an InvocationTargetException and an InterruptedException - see attached log. I need to SSH into the console, manually restart the service (`sudo systemctl restart antmedia`) and then the server will work as expected.

ant-media-server.log main.pkr.hcl setup_ant.sh

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

@Karel
I believe you can use ffmpeg in a bash script to create an RTMP stream using an mp4 file for a short period of time. You won't need to carry out any manual work in this approach.

You use use below commands to install the ffmpeg and generate the stream for few seconds.
 

sudo apt install ffmpeg

ffmpeg -f lavfi -i smptebars -t 30 smpte.mp4     //this will create the mp4 file of 30 seconds.

ffmpeg -re -i smpte.mp4 -codec copy -t 30 -f flv rtmp://localhost/LiveApp/test


After that your AMI should work fine without restarting the server.

Please let me know if it helps.
 

  • Thanks 1
Link to comment
Share on other sites

  • 0

Thank you @Yash. In this case I'm creating the image with Hashicorp Packer so it's fully automated and no human interaction is required. For now, I can create the AMI manually from an EC2, but IMO that's a workaround IMO and eventually I'll have to find a permanent, unattended solution. 

I've added a comment on the GitHub issue

Link to comment
Share on other sites

 Share

×
×
  • Create New...