Re-encoding Videos (SDK)
You can use Encord’s Python SDK to re-encode videos. See our detailed documentation on re-encoding for more information.
Use the dataset.re_encode_data() method to re-encode a list of videos, replacing <video1_data_hash> and <video2_data_hash> below with the hashes of the videos to be re-encoded.
The output is a list of task ID’s of each re-encoding job. The task_id
can be used to monitor the progress of the task.
EncordClient
. Any videos that do not belong to the Dataset used for initialisation are ignored.Check the status of a re-encoding task
Use the dataset.re_encode_data_status() method to get the status of an existing re-encoding task. Replace task_id
in the sample below with the task ID of the re-encoding task you’d like to check the status of.
The ReEncodeVideoTask object contains a status field, which can take the following values:
-
“SUBMITTED”: the task is currently in progress and the status should be checked back again later.
-
”DONE”: the task has been completed successfully and the field ‘result’ would contain metadata about the re-encoded video.
-
”ERROR”: the task has failed and could not complete the re-encoding.
Re-encode locally
Some cases, such as corrupted metadata, might require you to re-encode your data locally before uploading them to the Encord platform.
Use the following ffmpeg
command, replacing “video.mp4” with the name of the file you want to re-encode, and “re-encoded-video.mp4” with the name you want the re-encoded file to have:
Was this page helpful?