# Begin recording when you start a transcoder Learn how to use the REST API to record a live stream or transcoder in the Wowza Video™ service. Info This topic only applies to version 2.0 and later of the REST API. ## Before you start You should complete the following tasks: - Create a **live stream** or a **transcoder**. You'll need the resulting `live_stream_id` or `transcoder_id` to record a broadcast. View our View our [connect a source](/docs/wowza-video/guides/video-source/encoder-camera/connect-an-ip-camera) topics to learn how to create a live stream or transcoder for RTMP, RTSP, IP camera, SRT encoder, UDP encoder, WebRTC, and Wowza Streaming Engine. You should be familiar with the following concepts: - Available workflows for recording streams. You should choose between the following two workflows: - Decide between the **live stream** or **transcoder** workflow. See [Decide between a live stream or transcoder workflow](/docs/wowza-video/guides/livestream-or-transcoder-workflow/) for more information about these workflows. details summary Live stream workflow ## Live Stream Workflow ### 1. Configure your live stream to record when it starts You'll need to edit your live stream so that the `save_asset` parameter is set to `true`. You can skip this step if you set this parameter to `true` when you created the live stream. Endpoint Reference ``` curl -H "Content-Type: application/json" \ -H "Authorization: Bearer ${WV_JWT}" \ -X "PATCH" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]" \ -d $'{ "live_stream": { "save_asset": "true" } }' ``` ### 2. Start the live stream Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]/start" ``` ### 3. Stop recording You can stop the recording at any point before the live stream has ended or you can stop the live stream, which will end the recording. Info We recommend leaving the live stream running for 10 to 15 seconds after the end of the event. This ensures that the recording doesn't cut off prematurely. **Stop the recording:** Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/stop_recording" ``` **Stop the live stream:** Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/live_streams/[live_stream_id]/stop" ``` details summary Transcoder workflow ## Transcoder Workflow ### 1. Configure your transcoder to record when it starts You’ll need to configure the `properties` parameter. The `section` should be set to `save_asset`, the `key` to `mp4`, and the `value` to `true`. For more information, see [Set advanced properties with the Wowza Video REST API](/docs/wowza-video/guides/more-tasks/set-advanced-properties). Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/properties" { "property": { "save_asset": "mp4", "section": "recording", "value": "true" } } ``` ### 2. Start the transcoder Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/start" ``` ### 3. Stop recording You can stop the recording at any point before the stream has ended or you can stop the transcoder, which will end the recording. Info We recommend leaving the transcoder running for 10 to 15 seconds after the end of the event. This ensures that the recording doesn't cut off prematurely. **Stop the recording:** Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/stop_recording" ``` **Stop the transcoder:** Endpoint Reference ``` curl -X PUT \ -H "Authorization: Bearer ${WV_JWT}" \ "${WV_HOST}/api/${WV_VERSION}/transcoders/[transcoder_id]/stop" ```