-1

I can see that the python script is not throwing errors however I cant stream the video via VLC player.


  Metadata:
    title           : Media Server
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv, progressive), 640x360, q=2-31, 1 kb/s, 25 fps, 1k tbn
    Metadata:
      encoder         : Lavc60.3.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000 buffer size: 0 vbv_delay: N/A
frame= 1927 fps= 25 q=69.0 size=      92kB time=00:01:17.00 bitrate=   9.7kbits/s dup=13 drop=1 speed=0.98x     



import subprocess

# Input RTSP stream URL
input_stream_url = "rtsp://myStream"

# Wowza RTMP or RTSP URL (replace with your Wowza server's details)
wowza_url = "rtmp://myWowzaServer"

# Resolution 
desired_width = 640
desired_height = 360

# Video bitrate and frame rate settings
video_bitrate = "1240"  # 1240 Kbps
fps = 25

# Start FFmpeg process to pull and push the stream with specified settings
ffmpeg_command = [
    'ffmpeg',
    '-rtsp_transport', 'tcp',  # Use TCP for RTSP transport (optional)
    '-i', input_stream_url,    # Input RTSP stream URL
    '-s', f'{desired_width}x{desired_height}',  # Desired resolution
    '-c:v', 'libx264',        # Video codec: H.264
    '-b:v', video_bitrate,    # Video bitrate
    '-r', str(fps),            # Frame rate
    '-c:a', 'aac',            # Audio codec: AAC
    '-f', 'flv',              # Output format (FLV for RTMP, rtsp for RTSP)
    wowza_url                 # Wowza RTMP or RTSP URL
]

# Start FFmpeg as a subprocess
ffmpeg_process = subprocess.Popen(ffmpeg_command)

# Stop Condition
print("Press Enter to stop...")
input()

# Terminate FFmpeg when done
ffmpeg_process.terminate()

So far I have tried implementing best encoding practices as recommended by Wowza, have been messing with the frame rate, bitrate etc... but with no luck. Hopefully someone experienced with using FFMpeg can give suggestions / solutions??

Thanks!

0 Answers0