Skip to content

WebM generates an empty video file, H264 works as expected. #72

@benfeather

Description

@benfeather

Describe the bug

I'm using the transcoder plugin inside of a custom Craft module.

The plugin produces an empty video file when I transcode a video using the default WebM config.
However, if I use the default h264 config, the plugin works as expected.

Here is a cut-down version of the module:

public function actionIndex()
{
	$id = Craft::$app->request->get('id');

	if (!$id) {
		throw new \Exception('ID parameter is required.');
	}

	$asset = Asset::find()->id($id)->one();

	if (!$asset) {
		throw new \Exception("Asset matching ID '{$id}' not found.");
	}

	$transcoder = Craft::$app->plugins->getPlugin('transcoder');

	if (!$transcoder || !($transcoder instanceof Transcoder)) {
		throw new \Exception('Transcoder plugin not found.');
	}

	$url = $transcoder->transcode->getVideoUrl($asset, [
		'videoEncoder' => 'webm',
	]);

	return $this->asJson([
		'src' => $url,
	]);
}

If I manually run FFMPEG inside the ddev container, the video is transcoded to WebM as expected, so I don't believe FFMPEG is the issue.

Expected behaviour

A WebM version of the video asset is to be generated.

Versions

  • DDEV version: 1.22.7
  • PHP: 8.2.15
  • Plugin version: 4.0.1
  • Craft version: 4.7.4
  • FFMPEG version: 4.3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions