Giter Site home page Giter Site logo

Comments (9)

khalwat avatar khalwat commented on May 27, 2024

Show me the command line you used that did generate a .webm properly for you on your setup?

from craft-transcoder.

benfeather avatar benfeather commented on May 27, 2024

Here's the command: ffmpeg -i Input.mp4 -c:v libvpx -c:a libvorbis -quality good -cpu-used 0 Output.webm

from craft-transcoder.

khalwat avatar khalwat commented on May 27, 2024

And what is the command that Transcoder is outputting when you try to use it? It should be in your config/logs/web.log assuming devMode is on.

from craft-transcoder.

benfeather avatar benfeather commented on May 27, 2024

Here's the command that gets logged:

/usr/bin/ffmpeg -i '/var/www/html/web/uploads/videos/Racewell-Sheep-Handler/Dagging.mp4' -vcodec libvpx -quality good -cpu-used 0 -bufsize 1000k -threads 0 -vf "scale=300:240,unsharp=5:5:1.0:5:5:0.0" -c:a copy -f webm -y '/var/www/html/web/transcoder/video/Racewell-Sheep-Handler/Dagging_300w_240h.webm'

If I run that command, I get this error:

"Rate control parameters set without a bitrate. Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height"

I haven't modified the transcoder.php config file, so it should use the default values.

from craft-transcoder.

khalwat avatar khalwat commented on May 27, 2024

The default parameters that are in Transcoder definitely worked at one point for webm -- my guess is that something (whether ffmpeg itself, or the libvpx codex) changed in the interim.

The major different I can see between the command that worked, and the one that did not is the audio codec setting: -c:a copy is used as a default in Transcoder, and your example is explicitly using -c:a libvorbis

from craft-transcoder.

benfeather avatar benfeather commented on May 27, 2024

If you remove -bufsize 1000k, the command throws a different error:

Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM. Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 --

If you swap -c:a copy with -c:a libvorbis or -c:a libopus the conversion succeeds.

/usr/bin/ffmpeg \
	-i '/var/www/html/web/uploads/videos/Racewell-Sheep-Handler/Dagging.mp4' \
	-c:v libvpx \
	-c:a libvorbis \
	-quality good \
	-cpu-used 0 \
	-threads 0 \
	-vf "scale=300:240,unsharp=5:5:1.0:5:5:0.0" \
	-f webm \
	-y \
	'/var/www/html/web/transcoder/video/Racewell-Sheep-Handler/Dagging_300w_240h.webm'

from craft-transcoder.

benfeather avatar benfeather commented on May 27, 2024

I tried the command with -bufsize 1000k and -b:v 2M, and it worked. Looks like you have to set the target average bitrate for the bufsize flag to work.

I don't know what a reasonable default would be.

https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate

from craft-transcoder.

khalwat avatar khalwat commented on May 27, 2024

Maybe best to just remove the -bufsize flag entirely then, and let ffmpeg figure it out.

My guess is the reason why copy doesn't work is the encoding on the audio track is such that isn't supported in webm somehow.

In any event, glad you got it working!

from craft-transcoder.

benfeather avatar benfeather commented on May 27, 2024

It looks like the -bufsize flag is hardcoded into the FFmpeg command:

Transcode.php, line 131
CleanShot 2024-02-27 at 09 09 36@2x

Is that something you could remove? Or is there a way I can override it?

from craft-transcoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.