listen              1935;
max_connections     1000;
daemon              off;

vhost __defaultVhost__ {
  hls {
      enabled       on;
      hls_path      /srs/hls;
      hls_fragment  2;
      hls_window    10;
  }
  http_remux {
      enabled on;
  }
  # Record RTMP to files for VOD processing (FLV segments)
  dvr {
      enabled on;
      dvr_path /srs/rec/[app]/[stream].[timestamp].flv;
      dvr_plan segment;
      dvr_duration 300;      # 5-minute segments
      dvr_wait_keyframe on;  # Fixed: start segments on keyframe (was dvr_wait_key)
  }
  # For local testing, allow all; lock down for production
  play { }
  publish { }
}

# Example: SRS-driven transcoding (optional)
#
# transcode live to live_abr {
#   enabled      on;
#   ffmpeg       /usr/local/bin/ffmpeg;
#   # 360p, 480p, 720p outputs; adjust bitrates/presets as needed
#   engine 360p {
#     enabled   on;
#     vfilter   {
#       vf      scale=w=-2:h=360
#     }
#     vcodec    libx264;
#     vbitrate  800;
#     vfps      24;
#     vparams   "-preset veryfast -g 48 -sc_threshold 0";
#     acodec    aac;
#     abitrate  128;
#     aparams   "-ac 2";
#     output    rtmp://127.0.0.1/live_abr/[stream]?v=360p;
#   }
#   engine 480p {
#     enabled   on;
#     vfilter   {
#       vf      scale=w=-2:h=480
#     }
#     vcodec    libx264;
#     vbitrate  1400;
#     vfps      24;
#     vparams   "-preset veryfast -g 48 -sc_threshold 0";
#     acodec    aac;
#     abitrate  128;
#     aparams   "-ac 2";
#     output    rtmp://127.0.0.1/live_abr/[stream]?v=480p;
#   }
#   engine 720p {
#     enabled   on;
#     vfilter   {
#       vf      scale=w=-2:h=720
#     }
#     vcodec    libx264;
#     vbitrate  2800;
#     vfps      24;
#     vparams   "-preset veryfast -g 48 -sc_threshold 0";
#     acodec    aac;
#     abitrate  128;
#     aparams   "-ac 2";
#     output    rtmp://127.0.0.1/live_abr/[stream]?v=720p;
#   }
# }
