Git Product home page Git Product logo

codem-transcode's Introduction

IMPORTANT: This project is no longer actively maintained!


Codem-transcode

Description

Codem-transcode is an offline video transcoder written in node.js. It

  1. Uses ffmpeg for transcoding
  2. Has a simple HTTP API
  3. Is mostly asynchronous

Codem-transcode can be used in conjunction with Codem-schedule (https://github.com/madebyhiro/codem-schedule) for robust job scheduling and notifications or it can be used stand-alone, with or without a custom scheduler.

Requirements

Installation

The recommended installation procedure is to just use npm (http://npmjs.org/):

# npm install codem-transcode

Install it to your preferred location, or use the -g option to install it globally.

Upgrading

Upgrading should most of the times be as simple as shutting down, installing the new package and restarting the transcoder. Unless you're...

Upgrading from earlier versions to 0.5 (IMPORTANT!)

Codem-transcode switched from using "plain" SQL (using sqlite) to a database abstraction layer (Sequelize). This brings some advantages (support for multiple database engines, better consistency, easier migrations in the future), but is not backwards compatible. Therefore, we recommend you backup and move away your old database and start with a fresh one. The procedure for this would be:

  • Shutdown the transcoder;
  • Move your database away (or delete if you're not interested in the history);
  • Install the new package;
  • Start the transcoder.

This will initialize a new up-to-date database which can be migrated to newer schema's more easily in the future. If you are doing a clean install you do not need to worry about any of this.

If you want to keep your history we recommend you follow the above procedure and write a separate import script to import your old data into the new database.

Starting

When you install codem-transcode a script will be installed that allows you to start the transcoder. If you install it globally it should be in your PATH, otherwise, you can start the transcoder using:

# /PATH/TO/TRANSCODER/bin/codem-transcode

Please check for yourself where npm installs your packages and script.

Configuration

Configuration is done by specifying a CLI option (-c) and pointing to a file containing a valid JSON object (http://www.json.org/). Note that node.js' JSON parser is fairly strict so make sure you get the syntax right. An example config is:

{
    "port":            8080,
    "access_log":      "/var/log/access_log",
    "database":        "/var/db/jobs.db",
    "slots":           8,
    "interface":       "127.0.0.1",
    "encoder":         "ffmpeg",
    "scratch_dir":     "/tmp",
    "use_scratch_dir": true,
    "ffprobe":         null
}

Configuration options:

  • port; port to start server on, default 8080
  • interface; which network interface to listen on, default 127.0.0.1 (only localhost)
  • access_log; location to store HTTP access log, default /var/log/access_log
  • database; location to store the jobs database, default is SQLite with /var/db/jobs.db
  • slots; number of transcoding slots to use (i.e. the maximum number of ffmpeg child processes), defaults to the number of CPUs/cores in your machine
  • encoder; path to the ffmpeg binary, if it is in your path specifying only ffmpeg is sufficient, defaults to ffmpeg
  • scratch_dir; temporary files are written here and moved into the destination directory after transcoding, defaults to /tmp
  • use_scratch_dir; if set to false temporary files will be written to the output directory of your job, for setups that don't require or are not able to use a separate scratch_dir. Defaults to true so if you don't want to disable the scratch_dir you can also omit this option from your config file.
  • ffprobe; path to the ffprobe binary, if it is in your path specifying only ffprobe is sufficient, defaults to null. Set this to a non-null value if you want to enable ffprobe support in the transcoder.

Note that the default config will put the access_log and job database in /var/log and var/db/ respectively. If you wish to put these in a different location please supply your own config. You can start the transcoder with your custom config using:

# /PATH/TO/TRANSCODER/bin/codem-transcode -c /PATH/TO/CONFIG/config.json

Advanced database configuration

codem-transcode supports multiple database backends, courtesy of Sequelize. The default is still to store data in a SQLite database (whenever you specify a string for database in the config file). To use MySQL or Postgres, supply a valid object for the database entry. Your configuration will then look like:

{
    "port":            8080,
    "access_log":      "/var/log/access_log",
    "database":        {
        "dialect": "mysql",
        "username": "root",        
        "database": "codem",
        "host": "localhost",
        "port": 3306
    },
    "slots":           8,
    "interface":       "127.0.0.1",
    "encoder":         "ffmpeg",
    "scratch_dir":     "/tmp",
    "use_scratch_dir": true,
    "ffprobe":         null
}

Be sure to specify a dialect ("mysql", "postgres", "sqlite"), a username, a password (can be omitted if using a passwordless database) and a host (can be omitted for "localhost"). port can be omitted for the default port.

Usage

After starting the server you can control it using most HTTP CLI tools, such as curl or wget. The HTTP API is as follows:


Request: POST /jobs

Parameters (HTTP POST data, should be valid JSON object):

{
    "source_file": "/PATH/TO/INPUT/FILE.wmv",
    "destination_file":"/PATH/TO/OUTPUT/FILE.mp4",
    "encoder_options": "-acodec libfaac -ab 96k -ar 44100 -vcodec libx264 -vb 416k -s 320x180 -y -threads 0",
    "thumbnail_options": {
        "percentages": [0.25, 0.5, 0.75],
        "size": "160x90",
        "format": "png"
    },
    "segments_options" : {
      "segment_time": 10
    },
    "callback_urls": ["http://example.com/notifications"]
}

Responses:

  • 202 Accepted - Job accepted
  • 400 Bad Request - Invalid request (format)
  • 503 Service Unavailable - Transcoder not accepting jobs at the moment (all encoding slots are in use)

Required options are source_file, destination_file and encoder_options. Input and output files must be absolute paths.

The callback_urls array is optional and is a list (array) of HTTP endpoints that should be notified once encoding finishes (due to the job being complete or some error condition). The notification will sent using HTTP PUT to the specified endpoints with the job status. It will also include a custom HTTP header "X-Codem-Notify-Timestamp" that contains the timestamp (in milliseconds) at which the notification was generated and sent. It is best to observe this header to determine the order in which notifications are received at the other end due to network lag or other circumstances that may cause notifications to be received out of order.

The thumbnail_options object is optional and contains a set of thumbnails that should be encoded after the transcoding is complete. Thumbnails are captured from the source file for maximum quality. The options for thumbnails include:

  • Either "percentages" or "seconds" (but not both at the same time), valid options are:
    • A single percentage, this will trigger a thumbnail every x%. "percentages": 0.1 will generate thumbnails at 0%, 10%, 20%, [...], 100%.
    • An array of explicit percentages, this will trigger thumbnails only at the specified positions. "percentages": [0.25, 0.5, 0.75] will generate thumbnails at 25%, 50% and 75%.
    • A single offset in seconds, this will trigger a thumbnail every x seconds. "seconds": 10 will generate thumbnails at 0 seconds, 10 seconds, 20 seconds, etc., until the end of the source file.
    • An array of explicit offsets, this will trigger thumbnails only at the specified positions. "seconds": [30, 60, 90] will generate thumbnails at 30 seconds, 60 seconds and 90 seconds.
  • A size can be specified in pixels (width x height). If omitted it will generate thumbnails the size of the source video. (optional)
  • A format for the thumbnails. The format must be supported by your ffmpeg binary. If omitted it will generate thumbnails in the JPEG format. Most people will use either "jpg" or "png". (optional)

If you specify thumbnails but an error occurs during generation, your job will be marked as failed. If you don't specify a valid seconds or percentages option thumbnail generation will be skipped but the job can still be completed successfully.

Segmenting / HLS

The segments_options object is optional and contains segment time (duration) in seconds. Segmented videos are used in HLS. These options are applied to the encoded video, thus encoder_options are required. Moreover encoder_options should prepare video for segmenting, because bitstream filter h264_mp4toannexb will be applied to the video. Therefore it is recommended to transcode to an MP4 file before segmenting. Segmenting works by taking the output file from your transcoder job and applying segmenting to it.

The segmenting command looks like:

ffmpeg -i /tmp/46ee0a404a4b75d85c09d98a7c6b403579ee9f99.mp4 -codec copy -map 0 \
  -f segment -vbsf h264_mp4toannexb -flags -global_header -segment_format mpegts \
  -segment_list /path/to/dest_file_dir/dest_file_name.m3u8 -segment_time 10 \
  /path/to/dest_file_dir/dest_file_name-%06d.ts

46ee0a404a4b75d85c09d98a7c6b403579ee9f99.mp4 is a temporary encoded file (generated by Codem). After transcoding and segmenting you end up with the transcoded file, as well as the segments/playlist.

Thumbnail-only job

It's possible to only generate thumbnails from a video and not do any transcoding at all. This might come in handy if you're transcoding to lots of different formats and want to keep thumbnail generation separate from transcoding. You achieve this by POSTing a job with "encoder_options": "" (empty string) and of course specifying your thumbnail_options. In this case destination_file should be a prefix for the output file, e.g. "destination_file": "/Users/codem/output/my_video" results in thumbnails in /Users/codem/output/ with filenames such as my_video-$offset.$format (where $offset is the thumbnail offset in the video and $format of course the thumbnail format). All other options remain the same. See the examples.


Request: GET /jobs

Responses:

  • 200 OK - Returns status of all active jobs

Request: GET /jobs/$JOB_ID

Responses:

  • 200 OK - Returns status of job
  • 404 Not Found - Job not found

Request: DELETE /jobs/$JOB_ID

Cancels the job (if it is running) and deletes it from the database.

Responses:

  • 200 OK - Returns last known status of the job that is being deleted
  • 404 Not Found - Job not found

Request: DELETE /jobs/purge/$AGE

Purge successfully completed jobs from the database with a certain age. Age is specified in seconds since it was created. So an age of 3600 deletes jobs that were successful and created more than 1 hour ago.

Responses:

  • 200 OK - Returns number of jobs that were purged.

Request: POST /probe

Probe a source file using ffprobe (if you have enabled it in the configuration). Output is a JSON object containing the ffprobe output.

Parameters (HTTP POST data, should be valid JSON object):

{
    "source_file": "/PATH/TO/INPUT/FILE.wmv"
}

Responses:

  • 200 OK - Returns ffprobe output JSON-formatted
  • 400 Bad Request - Returned if you attempt to probe a file when there is no path set to the ffprobe binary
  • 500 Internal Server Error - Returned if there was an error while trying to probe, the output from ffprobe will be returned as well

Examples

Create a new job, transcode "video.wmv" to "video.mp4" using the specified ffmpeg options (96kbit/s audio, 416kbit/s video, 320x180, use as much threads as possible). Requires libx264 support in your ffmpeg.

# curl -d '{"source_file": "/tmp/video.wmv","destination_file":"/tmp/video.mp4","encoder_options": "-acodec libfaac -ab 96k -ar 44100 -vcodec libx264 -vb 416k -s 320x180 -y -threads 0"}' http://localhost:8080/jobs

Output: {"message":"The transcoder accepted your job.","job_id":"d4b1dfebe6860839b2c21b70f35938d870011682"}

Create a new job, transcode "video.mpg" to "video.webm" using the specified ffmpeg options (total bitrate 512kbit/s, 320x180, use as much threads as possible). Requires libvpx support in your ffmpeg.

# curl -d '{"source_file": "/tmp/video.mpg","destination_file":"/tmp/video.webm","encoder_options": "-vcodec libvpx -b 512000 -s 320x180 -acodec libvorbis -y -threads 0"}' http://localhost:8080/jobs

Output: {"message":"The transcoder accepted your job.","job_id":"c26769be0955339db8f98580c212b7611cacf4dd"}

Get status of all available encoder slots.

# curl http://localhost:8080/jobs

Output: {"max_slots":8,"free_slots":8,"jobs":[]}

or

Output: {"max_slots":8, "free_slots":7, "jobs":[{"id":"da56da6012bda2ce775fa028f056873bcb29cb3b", "status":"processing", "progress":0.12480252764612954, "duration":633, "filesize":39191346, "message":null}]}

Get full status of one job with id "da56da6012bda2ce775fa028f056873bcb29cb3b".

# curl http://localhost:8080/jobs/da56da6012bda2ce775fa028f056873bcb29cb3b

Output: {"id":"da56da6012bda2ce775fa028f056873bcb29cb3b", "status":"processing", "progress":0.21800947867298578, "duration":633, "filesize":39191346, "opts":"{\"source_file\":\"/shared/videos/asf/video.asf\", \"destination_file\":\"/shared/videos/mp4/journaal.mp4\", \"encoder_options\":\"-acodec libfaac -ab 96k -ar 44100 -vcodec libx264 -vb 416k -s 320x180 -y -threads 0\"}", "message":null, "created_at":1304338160, "updated_at":1304338173}

Probe a file using ffprobe.

# curl -d '{"source_file": "/tmp/video.wmv"}' http://localhost:8080/probe

Output: {"ffprobe":{"streams":[ ... stream info ... ],"format":{ ... format info ... }}}}

Thumbnail-only job (160x90 in PNG format every 10% of the video).

# curl -d '{"source_file": "/tmp/video.mp4","destination_file":"/tmp/thumbnails/video","encoder_options": "", "thumbnail_options": { "percentages": 0.1, "size": "160x90", "format": "png"} }' http://localhost:8080/jobs

Output: {"message":"The transcoder accepted your job.","job_id":"d4b1dfebe6860839b2c21b70f35938d870011682"}

Segmenting job.

# curl -d '{"source_file": "/tmp/video.mp4", "destination_file": "/tmp/output/test.mp4", "encoder_options": "-vb 2000k -minrate 2000k -maxrate 2000k -bufsize 2000k -s 1280x720 -acodec aac -strict -2 -ab 192000 -ar 44100 -ac 2 -vcodec libx264 -movflags faststart", "segments_options": {"segment_time": 10} }' http://localhost:8080/jobs

Output: {"message":"The transcoder accepted your job.","job_id":"7dc3c268783d7f3c737f3a134ccf1d4f15bb8442"}

Status of finished job:

# curl http://localhost:8080/jobs/7dc3c268783d7f3c737f3a134ccf1d4f15bb8442

Output:
{
  "id": "7dc3c268783d7f3c737f3a134ccf1d4f15bb8442",
  "status": "success",
  "progress": 1,
  "duration": 1,
  "filesize": 783373,
  "message": "ffmpeg finished succesfully.",
  "playlist": "/tmp/output/test.m3u8",
  "segments": [
    "/tmp/output/test-000000.ts",
    "/tmp/output/test-000001.ts",
    "/tmp/output/test-000002.ts",
    "/tmp/output/test-000003.ts",
    "/tmp/output/test-000004.ts",
    "/tmp/output/test-000005.ts"
  ]
}

Segmenting-only job (you are expected to have a valid MP4 file suitable for segmenting as the input).

# curl -d '{"source_file": "/tmp/video.mp4","destination_file":"/tmp/segments/video.mp4","encoder_options": "", "segments_options": {"segment_time": 10} }' http://localhost:8080/jobs

Output: {"message":"The transcoder accepted your job.","job_id":"c7599790527c0bb173cc7a0c44411aaca5c1550a"}

Status of finished job:

# curl http://localhost:8080/jobs/c7599790527c0bb173cc7a0c44411aaca5c1550a

Output:
{
  "id":"c7599790527c0bb173cc7a0c44411aaca5c1550a",
  "status":"success",
  "progress":1,
  "duration":26,
  "filesize":6734045,
  "message":"finished segmenting job.",
  "playlist":"/tmp/segments/video.m3u8",
  "segments":[
    "/tmp/segments/video-000000.ts",
    "/tmp/segments/video-000001.ts",
    "/tmp/segments/video-000002.ts"
  ]
}

Issues and support

If you run into any issues while using codem-transcode please use the Github issue tracker to see if it is a known problem or report it as a new one.

We also provide commercial support for codem-transcode (for bugs, features, configuration, etc.). If you are interested in commercial support or are already receiving commercial support, feel free to contact us directly at [email protected].

License

Codem-transcode is released under the MIT license, see LICENSE.txt.

codem-transcode's People

Contributors

brain64bit avatar cutalion avatar mirion avatar scottf-tvw avatar unrob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codem-transcode's Issues

sqlite3 installation error

I tried to install codem-transcode using npm on OS X Mavericks: sudo npm install -g codem-transcode but I got this following errors:

> [email protected] install /usr/local/lib/node_modules/sqlite3
> node build.js

[sqlite3]: Checking for http://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.1.a-node-v11-darwin-x64.tar.gz
[sqlite3]: Error: ENOENT, open '/Users/koes/tmp/node-sqlite3-Release/node_sqlite3-v2.1.a-node-v11-darwin-x64.tar.gz'
npm ERR! [email protected] install: node build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.22/bin/node" "/usr/local/bin/npm" "install" "-g" "sqlite3" "--production"
npm ERR! cwd /Users/koes
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/koes/npm-debug.log
npm ERR! not ok code 0

I understand that this is sqlite3 issue, but is there any way to bypass this? I successfully installed sqlite3 using: sudo npm install -g sqlite3 --build-from-source

High volume of logging if codem-transcode can't open the log file.

If you launch the transcoder with config options that don't reference a valid logging location (due to file-system permissions for example) you'll get a very large number of log entries on STDOUT, e.g.:

30 Apr 09:13:56 - Error while logging to access_log. Error: EACCES, open '/var/log/access_log'
30 Apr 09:13:56 - Error while logging to access_log. Error: EACCES, open '/var/log/access_log'
30 Apr 09:13:56 - Error while logging to access_log. Error: EACCES, open '/var/log/access_log'
30 Apr 09:13:56 - Error while logging to access_log. Error: EACCES, open '/var/log/access_log'

Workaround for now of course is to specify a valid location.

Allow removal/cancellation of jobs

It would be nice to be able to cancel and/or remove jobs. Most likely via a HTTP DELETE request:

curl -XDELETE http://$TRANSCODER/jobs/$ID

Corrupt source files displaying as successful

FFmpeg is processing uploaded source files are incomplete or broken uploads. The fact that it starts processing is not a problem, but codem-transcode seems to be reporting a successful job.

I just upgraded to the newest version after starting to use codem-transcode about a year and a half ago. In the previous version I was using I had to compile FFmpeg myself, but codem would show a failed state if the job was not able to complete fully.

I might try a fix myself by comparing the original duration with the duration of the transcoded result, as the corrupt file seems to be displaying the correct duration of the original un-corrupted version.

How easy would it be to give an exit message of "finished, but corrupted source file" or something to that effect?

Thanks for all your hard work, it is so greatly appreciated! The RPM's make everything so much easier too!

Cannot find module './dialects/undefined/connector-manager'

Can someone assit me on this error I get when attempting to start ./codem-transcode

module.js:340
throw err;
^
Error: Cannot find module './dialects/undefined/connector-manager'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at new module.exports.Sequelize (/usr/local/share/npm/lib/node_modules/codem-transcode/node_modules/sequelize/lib/sequelize.js:81:28)
at Object.JobUtils.getDatabase (/usr/local/share/npm/lib/node_modules/codem-transcode/lib/job.js:30:24)
at Object. (/usr/local/share/npm/lib/node_modules/codem-transcode/lib/job.js:91:20)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)

Thanks.

Error While Installing Codem Transcode

Hi,

I got the following error while installing codem transcode. I have installed the dependencies succesfully.

[root@localhost cme]# npm install codem-transcode -g
npm http GET https://registry.npmjs.org/codem-transcode
npm http 304 https://registry.npmjs.org/codem-transcode
npm http GET https://registry.npmjs.org/sequelize
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/sqlite3
npm http GET https://registry.npmjs.org/argsparser
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/sqlite3
npm http 304 https://registry.npmjs.org/argsparser
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/sequelize
npm http GET https://registry.npmjs.org/sqlite3/-/sqlite3-2.2.3.tgz
npm http 304 https://registry.npmjs.org/async
npm http 200 https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/sqlite3/-/sqlite3-2.2.3.tgz
npm http GET https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore.string
npm http GET https://registry.npmjs.org/lingo
npm http GET https://registry.npmjs.org/validator
npm http GET https://registry.npmjs.org/moment
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/generic-pool
npm http GET https://registry.npmjs.org/dottie
npm http 304 https://registry.npmjs.org/connect
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/formidable
npm http 304 https://registry.npmjs.org/underscore.string
npm http 304 https://registry.npmjs.org/lingo
npm http 304 https://registry.npmjs.org/moment
npm WARN deprecated [email protected]: This project is abandoned
npm http 304 https://registry.npmjs.org/validator
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/underscore

[email protected] install /usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

node-pre-gyp http GET https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz
node-pre-gyp http 200 https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz
[sqlite3] Command failed:
module.js:356
Module._extensions[extension](this, filename);
^
Error: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3/lib/binding/node-v11-linux-x64/node_sqlite3.node)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at [eval]:1:1
at Object. ([eval]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:536:25)
at startup (node.js:80:7)
at node.js:906:3

node-pre-gyp ERR! Testing pre-built binary failed, attempting to source compile
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:807:12)
gyp ERR! System Linux 2.6.32-431.el6.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=sqlite3" "--configuration=Release" "--module_name=node_sqlite3" "--version=2.2.3" "--major=2" "--minor=2" "--patch=3" "--runtime=node" "--node_abi=node-v11" "--platform=linux" "--arch=x64" "--target_arch=x64" "--module_main=./lib/sqlite3" "--host=https://node-sqlite3.s3.amazonaws.com/" "--module_path=/usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3/lib/binding/node-v11-linux-x64" "--remote_path=./Release/" "--package_name=node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz" "--staged_tarball=build/stage/Release/node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz" "--hosted_path=https://node-sqlite3.s3.amazonaws.com/Release/" "--hosted_tarball=https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz"
gyp ERR! cwd /usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node rebuild --name=sqlite3 --configuration=Release --module_name=node_sqlite3 --version=2.2.3 --major=2 --minor=2 --patch=3 --runtime=node --node_abi=node-v11 --platform=linux --arch=x64 --target_arch=x64 --module_main=./lib/sqlite3 --host=https://node-sqlite3.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3/lib/binding/node-v11-linux-x64 --remote_path=./Release/ --package_name=node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz --staged_tarball=build/stage/Release/node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz --hosted_path=https://node-sqlite3.s3.amazonaws.com/Release/ --hosted_tarball=https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.3-node-v11-linux-x64.tar.gz' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:753:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:5)
node-pre-gyp ERR! System Linux 2.6.32-431.el6.x86_64
node-pre-gyp ERR! command "node" "/usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3
node-pre-gyp ERR! node -v v0.10.28
node-pre-gyp ERR! node-pre-gyp -v v0.5.9
node-pre-gyp ERR! not ok
npm http 304 https://registry.npmjs.org/generic-pool
npm http 304 https://registry.npmjs.org/formidable
npm http 304 https://registry.npmjs.org/dottie
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-431.el6.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "codem-transcode" "-g"
npm ERR! cwd /home/cme
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/cme/npm-debug.log
npm ERR! not ok code 0

It would be appreciated if anyone could help me on this.

Caught exception: Error: spawn ENOENT

I keep getting the following exception every time I submit a job to the transcoder. From a little research that I did the ENOENT exception is supposed to be a URL access error but if I was to do a wget to the URL from the server itself it returns the correct page which tells me that the URL is accessible from the server.

Has anyone seen this before?

8 May 23:48:33 - Job 48f6465a1475b7a3b1e7da79b7af8990c614f0a6 accepted with opts: "{ source_file: '/path/to/source/uploads/original/1c6ab_MVI_1380.MOV', destination_file: '/path/to/destination/uploads/transcoded/1c6ab_MVI_1380.webm', encoder_options: '-vcodec libvpx -acodec libvorbis -ar 110000 -f webm -g 30 -b 75M -s 1280x720', callback_urls: [ 'http://example.com/user/notify/status/id/21/tid/41/' ] }" 8 May 23:48:33 - Caught exception: Error: spawn ENOENT

FFprobe integration

Before every transcode session, I need to retrieve info on the source file to determine output settings. It would be efficient to incorporate this function into the codem-transcode package as it could allow for a single system to manage all the transcoding tasks as well as some automated presets based on input file parameters.

There is a handy package already available to retrieve json data from source files which could be added easily into the codem system: https://npmjs.org/package/node-ffprobe

Allow disabling of "scratch_dir"

There should be a config option to disable using a scratch directory. Transcoder should just attempt to write the tmp file in the output directory if that is the case.

npm build failing with 404 errors

1950 verbose addNamed [ 'commander', '0.6.1' ]
1951 verbose addNamed [ '0.6.1', '0.6.1' ]
1952 silly lockFile fa16a2ce-commander-0-6-1 [email protected]
1953 verbose lock [email protected] /root/.npm/fa16a2ce-commander-0-6-1.lock
1954 silly gunzTarPerm extractEntry lib/language.js
1955 silly gunzTarPerm extractEntry lib/lingo.js
1956 silly lockFile 378c912a-rg-commander-commander-0-6-1-tgz https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
1957 verbose lock https://registry.npmjs.org/commander/-/commander-0.6.1.tgz /root/.npm/378c912a-rg-commander-commander-0-6-1-tgz.lock
1958 silly gunzTarPerm extractEntry package.json
1959 silly gunzTarPerm extractEntry Gemfile
1960 silly gunzTarPerm extractEntry dist/underscore.string.min.js
1961 verbose addRemoteTarball [ 'https://registry.npmjs.org/commander/-/commander-0.6.1.tgz',
1961 verbose addRemoteTarball 'fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06' ]
1962 info retry fetch attempt 1 at 03:21:24
1963 verbose fetch to= /root/tmp/npm-1846-gSxYegNK/1393633284629-0.05237002111971378/tmp.tgz
1964 silly gunzTarPerm extractEntry .npmignore
1965 silly gunzTarPerm extractEntry README.md
1966 http GET https://registry.npmjs.org/commander/-/commander-0.6.1.tgz
1967 verbose tar unpack /root/tmp/npm-1846-gSxYegNK/1393633284379-0.8179723471403122/tmp.tgz
1968 silly lockFile e2085770-84379-0-8179723471403122-package tar:///root/tmp/npm-1846-gSxYegNK/1393633284379-0.8179723471403122/package
1969 verbose lock tar:///root/tmp/npm-1846-gSxYegNK/1393633284379-0.8179723471403122/package /root/.npm/e2085770-84379-0-8179723471403122-package.lock
1970 silly lockFile 809bb65e-84379-0-8179723471403122-tmp-tgz tar:///root/tmp/npm-1846-gSxYegNK/1393633284379-0.8179723471403122/tmp.tgz
1971 verbose lock tar:///root/tmp/npm-1846-gSxYegNK/1393633284379-0.8179723471403122/tmp.tgz /root/.npm/809bb65e-84379-0-8179723471403122-tmp-tgz.lock
1972 error Error: 404 Not Found
1972 error at WriteStream. (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:57:12)
1972 error at WriteStream.EventEmitter.emit (events.js:117:20)
1972 error at fs.js:1598:14
1972 error at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:105:5
1972 error at Object.oncomplete (fs.js:107:15)
1973 error If you need help, you may report this entire log,
1973 error including the npm and node versions, at:
1973 error http://github.com/npm/npm/issues
1974 error System Linux 2.6.32-042stab078.28
1975 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "codem-transcode"
1976 error cwd /usr/src
1977 error node -v v0.10.26
1978 error npm -v 1.4.3
1979 verbose exit [ 1, true ]

Generate SPRITE image for thumbnail

Hi,

First of all i would like to say a big Thank You for creating such a wonderful software and donating it to OpenSource community.
I have one question, we have such a requirement where we want to generate thumbnail of every 10 seconds and create its sprite image. I know ffmpeg command to do this. Is it possible to do this with CODEM ?

Thanks,
Mahesh

Transcoder accepts new jobs when it can't spawn ffmpeg.

When ffmpeg can't be spawned by the transcoder (due to permissions or in some other way the binary can't be found) it still accepts jobs, but these will never finish or complete.

Don't accept jobs if ffmpeg can't be spawned.

v.1.0-alpha: job failed processing with bunyan usage error

codem-transcode accepts the job, but then fails with "bunyan usage error":

bunyan usage error: C:\Users\Grid405\AppData\Roaming\npm\node_modules\codem-transcode\lib\request_handler.js:171: attempt to log with an unbound log method: this is: RequestHandler {
_logger:
Logger {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
_level: 30,
streams: [ [Object] ],
serializers: { req: [Function: req], res: [Function: res] },
src: false,
fields: { name: 'codem-transcode', hostname: 'Grid405-PC', pid: 8888 },
haveNonRawStreams: true },
_storageBackend:
MemoryStorageBackend {
_cache:
LRUCache {
size: 1,
limit: 500,
_keymap: [Object],
head: [Object],
tail: [Object] } },
_totalAvailableSlots: 4,
_processorBackends: Map { 'codem-ffmpeg' => [Function: FFmpeg] },
_processors:
Map {
'eee1c0f889a976ac5eeb9040f185a44010a05196' => FFmpeg {
domain: null,
_events: [Object],
_eventsCount: 4,
_maxListeners: undefined,
_args: [Object],
_childProcess: [Object],
_output: '' } } }
{"name":"codem-transcode","hostname":"Grid405-PC","pid":8888,"level":30,"context":{"exitCode":1,"id":"eee1c0f889a976ac5eeb9040f185a44010a05196"},"msg":"Job failed processing.","time":"2017-04-19T13:27:33.489Z","v":0}

Transcoder breaks when log filesystem is full

Whenever the filesystem that contains the log file is full, the following error occurs:

22 Aug 20:12:03 - Caught exception: Error: ENOSPC, No space left on device
Error: stream not writable
    at [object Object].write (fs.js:1065:11)
    at ServerResponse.<anonymous> (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/logger.js:128:16)
    at Object.<anonymous> (/d/pleakley-app/ro/06/ap/codem-transcode/codem-transcode/lib/server.js:50:12)
    at nextMiddleware (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:175:25)
    at param (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:183:16)
    at pass (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:191:10)
    at Object.router [as handle] (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:197:6)
    at next (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/http.js:204:15)
    at Object.logger [as handle] (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/logger.js:138:5)
    at next (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/http.js:204:15)
Error: Can't set headers after they are sent.
    at ServerResponse.<anonymous> (http.js:526:11)
    at ServerResponse.setHeader (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/patch.js:44:20)
    at next (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/http.js:168:13)
    at param (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:189:13)
    at pass (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:191:10)
    at Object.router [as handle] (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/router.js:197:6)
    at next (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/http.js:204:15)
    at Object.logger [as handle] (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/middleware/logger.js:138:5)
    at next (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/http.js:204:15)
    at HTTPServer.handle (/d/pleakley-app/ro/06/ap/ico/node_modules/connect/lib/http.js:217:3)
Error: Can't set headers after they are sent.

After that the transcoder is in a state where it doesn't evict finished jobs that were running at that time.

Install depends on old packages and non-existing too

I tried install transocde today, so I wrote npm install codem-transcode and I got at the beginning:

transcoder@file78-4-eu:~$ npm install codem-transcode
npm WARN deprecated [email protected]: critical security fix in v3.0.0
npm WARN engine [email protected]: wanted: {"node":">= 0.8.0 < 0.13.0"} (current: {"node":"4.2.2","npm":"2.14.7"})
npm WARN deprecated [email protected]: This project is abandoned
npm WARN deprecated [email protected]: Use `setimmediate` instead

I wonna use your system on many machines but it won't install :) After many warnings sqlite3 returned error from node-gyp:

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1

Installation aborted.

concat & mutli-output

I want to be able to use the concat feature of ffmpeg with the transcoder using a txt list of files. is there any way to simply override the -i and in the transcoder? I am pretty new to this projects code and I am sure I can figure out how to override by catching an input file name of concat and removing the -i. I just need a little guidance to know where things are happening in the code..
https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files

Another feature that would be nice it to be able to leverage the capability of ffmpeg to generate multiple outputs from a singe input.
https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs

Using Concatenation command

Hi,
How can i assign a job to concatenate 3 files using ffmpeg via codem transcode? is it possible?

Here is the code that i want to assign as a job !

ffmpeg -i "concat:/home/cinesoft/input/Films/Aanavaal mothiram/VIDEO_TS/VTS_01_1.VOB|/home/cinesoft/input/Films/Aanavaal mothiram/VIDEO_TS/VTS_01_2.VOB|/home/cinesoft/input/Films/Aanavaal mothiram/VIDEO_TS/VTS_01_3.VOB" -f mpeg -c copy /home/cinesoft/input/aanaval.VOB

Helps would be appreciated.

Encoder options with double quotes don't work

NodeJS butchers arguments that you pass using child_process.spawn. For example, the following job fails when going into the transcoder:

$ curl -XPOST -d '{
    "source_file": "/tmp/sinterklaas.mov",
    "destination_file":"/tmp/sinterklaas_out.mov",
    "encoder_options": "-acodec copy -vcodec libx264 -vf \"scale=60:60\""
}' http://localhost:8080/jobs

With error:

"ffmpeg finished with an error: '[AVFilterGraph @ 0x7faa18e0b900] No such filter: '"scale'Error opening filters!
' (1)."

While executing it directly from the command line works:

$ ffmpeg -i /tmp/sinterklaas.mov -acodec copy -vcodec libx264 -vf "scale=60:60" /tmp/sinterklaas2.mov

/jobs/:id is MUCH slower than /jobs

When running 3 jobs on a server (using all slots), Transcoder becomes extremely slow when performing a GET /jobs/:id but the GET /jobs works just fine.

Since Scheduler depends on /jobs/:id, it also becomes utterly slow.

Any ideas on how to troubleshoot this?

hướng dẫn tạo video lên top google

hướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top googlehướng dẫn tạo video lên top google

PID file

Add pid file location on config, for upstart scripts

Watchdog and removal of files

HI. It's not a issue, more a info on how to achieve something.
First at all, transcodem ois such a great and simple approach to transcoding! many thanks for releasing it.
I 'm wondering how to use in a watchdog mode, scanning new files in a folder and executing jobs. I thought about doing this with "*.mp4" as an input ? How about removing already encoded files for not repeting the encoding ?

Many thanks in advance

Cannot find module './dialects/undefined/connector-manager'

Can someone assit me on this error I get when attempting to start ./codem-transcode

module.js:340
throw err;
^
Error: Cannot find module './dialects/undefined/connector-manager'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at new module.exports.Sequelize (/usr/local/share/npm/lib/node_modules/codem-transcode/node_modules/sequelize/lib/sequelize.js:81:28)
at Object.JobUtils.getDatabase (/usr/local/share/npm/lib/node_modules/codem-transcode/lib/job.js:30:24)
at Object. (/usr/local/share/npm/lib/node_modules/codem-transcode/lib/job.js:91:20)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)

Thanks.

External mysql2 connection

When i try to configure the config file for an external mysql server, i got the error
"You need to install mysql package manually" when i start the codem-transcode server

{
"port": 8080,
"access_log": "/var/log/access_log",
"database": {
"dialect": "mysql",
"username": "root",
"database": "codem",
"host": "IP adress of my external server",
"port": 3306
},
"slots": 8,
"interface": "127.0.0.1",
"encoder": "ffmpeg",
"scratch_dir": "/tmp",
"use_scratch_dir": true,
"ffprobe": null
}

PHP Port

NodeJS is great.

But it has too much dependencies.
So my Question is:
Is it possible to port codem-transcode and codem-schedule to PHP without loss of features ?
When yes then i will start porting to PHP and release it here on Github.

I love the UI built on Twitter Bootstraped.

Regards Sascha
Watch-Video CEO

node-sqlite3 is throwing error, does it affect Transcodem?

Hi,
I am trying to install codem-transcode on CentOS 6.5 and getting following error

[sqlite3] Command failed: 
module.js:356
  Module._extensions[extension](this, filename);
                               ^
Error: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/lib/node_modules/codem-transcode/node_modules/sqlite3/lib/binding/node-v11-linux-x64/node_sqlite3.node)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [eval]:1:1
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:559:25)
    at startup (node.js:80:7)
    at node.js:929:3

I also see an open issue on here
Does it affect Transcodem and how to resolve it for CentOS 6.5?

ffmpeg error logging doesn't always work correctly

The transcoder doesn't always log the correct ffmpeg error message. For example, this job failed with error message:

ffmpeg finished with an error: 'ffmpeg version 0.7-rc1, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 6 2011 14:02:45 with gcc 4.1.2 20070925 (Red Hat 4.1.2-33) configuration: --prefix=/software/ffmpeg-codem-0.7-rc1-bcbce67e --disable-sha

That's not really helpful. Apparently not everything from STDERR was read properly before the "failed" callback was called.

Error when encoding to HLS

When using ffmpeg from the command line the first command works. Since hls encoding creates multiple segments from the video files I am having trouble getting this to work. The code only seems to support a single output. Can this feature be added to the repo?

Command Line
ffmpeg -i LM.mp4 -vb 2500k -minrate 2500k -maxrate 2500k -bufsize 2500k -vf "scale='min(iw,1280)':-1" -s 1280x720 -acodec libfaac -ab 128000 -ar 44100 -ac 2 -vcodec libx264 -sn -r 29.97 -map 0 -f segment -segment_time 10 -segment_list playlist.m3u8 -segment_format mpegts -vbsf h264_mp4toannexb -flags -global_header 720p-%d.ts -threads 0

Preset
I entered this string as a preset in the scheduler.
ffmpeg -i LM.mp4 -vb 2500k -minrate 2500k -maxrate 2500k -bufsize 2500k -vf scale='min(iw,1280)':-1 -s 1280x720 -acodec libfaac -ab 128000 -ar 44100 -ac 2 -vcodec libx264 -sn -r 29.97 -map 0 -f segment -segment_time 10 -segment_list playlist.m3u8 -segment_format mpegts -vbsf h264_mp4toannexb -flags -global_header 720p-%d.ts -threads 0

Can not start codem-transcode

This is what im get.

sudo /usr/local/lib/node_modules/codem-transcode/bin/codem-transcode

module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module '../build/Release/node_sqlite3.node'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object. (/usr/local/lib/node_modules/codem-transcode/node_modules/sqlite3/lib/sqlite3.js:1:104)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:32)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)

Allow purging of old (completed) jobs

Feature: purging old jobs from the database so it doesn't fill up (sqlite has some performance issues on large sets). This should be a user-configurable option (default: don't purge).

Might be triggered by calling an endpoint (/jobs/purge?) or by an internal timer periodically.

Idea: Incorporate provision for AWS Lambda

Hi there,

AWS Lambda seems to be a perfect solution for indefinitely scalable processing jobs like ffmpeg transcoding. They already mention node-ffmpeg in their documentation. This will be great if there's a version of codem which runs in Lambda and acts when source videos are uploaded into S3, processes it and puts the resulting video in another bucket.

Thanks!
Shafqat

Transcoder sometimes doesn't clear jobs from memory correctly

If you submit a large amount of jobs, at some point some jobs will remain in the state processing even though they have actually finished and are cleared from the available slots. If you retrieve such an item using its ID, it will still show as processing. If you retrieve the /jobs endpoint they will not show up in there, and the log file will show that the ffmpeg process has finished correctly.

This requires some additional investigation as it's not entirely clear why this happens. It could be due to the database adapter used (in this case MySQL), or some sort of race condition.

-ss and or -t should be before -i

if -ss is used in options, it should be placed before the input file as per the documentation for seek on the input file. Finding and extracting -ss would be needed in the jobs.js file and pushed into the string before -i. This can solve issues with mp4 files audio and video sync issues on long format videos.

Transcode via LAN

Hi,

I have successfully compiled codem-transcode and it works fine in my PC. I have changed the local host to my local IP in the cofig.json file. And started the server. It works fine and i could successfully assign job to the server from my PC. When i try to assign a job to my server from another PC of my LAN i couldn't acces the server.

it shows the error : curl: (7) coudn't connect to host

Im providing my config file data below,

{
"port": 8081,
"access_log": "/var/log/access_log",
"database": "/var/db/jobs.db",
"slots": 8,
"interface": "10.10.12.102",
"encoder": "/usr/local/bin/ffmpeg",
"scratch_dir": "/tmp",
"use_scratch_dir": true,
"ffprobe": null
}

It would be appreciated if anyone could help me on this.

Object storage integration

I'm working on a Docker-based workflow for transcoding that does not depend on a mounted filesystem for the input and output directories. Has anyone considered integration with an object storage system like S3 or (in my case) OpenStack Swift? At the moment the in and out directory configurations are assumed to be absolute filesystem paths, but I would think it could be relatively straightforward to do some pre-processing on those strings and use some prefix like "swift://" to invoke a library such as pkgcloud to fetch or upload the files?

I'm not a node developer but the code is pretty clear. Just wondering if the maintainers have thoughts on the best way to approach this. Thanks.

Encoder locking up on job request, stalling scheduler

jobs/$id call locking up and does not respond, I am not getting any further output from the stdout watching the encoder. I have about 4300 jobs in cue from the scheduler and 2 encoders. one encoder continues to lock up on curl requests on specific job id requests. the regular /job request works fine..
it never times out.. I would like to move the db to mysql but I could never get the packages to jive on ubuntu 14 and get it working. since I am in a crunch on this, I would be willing to use pay services to get this resolved quickly..

Init script with codem-transcode and CentOS 7 not working

I installed codem-transcode on CentOS - 7 and the script " init.d " no longer works with this version of the system.

If i try to run this command:

runuser -l codem -c "/home/codem/node_modules/codem-transcode/bin/codem-transcode -c /home/codem/node_modules/codem-transcode/config/server-IP_3000.json"

It is working fine

Here is the script:

!/bin/sh

chkconfig: 35 99 99

description: Node.js /home/codem/node_modules/codem-transcode/bin

. /etc/rc.d/init.d/functions

USER="codem"

DAEMON="/home/codem/node_modules/codem-transcode/bin/codem-transcode"
ROOT_DIR="/home/codem/node_modules/codem-transcode/bin"

SERVER="$ROOT_DIR/codem-transcode"
LOG_FILE="/var/log/codem-transcode/codem-transcode.log"

LOCK_FILE="/var/lock/subsys/codem-transcode"

do_start()
{
if [ ! -f "$LOCK_FILE" ] ; then
echo -n $"Starting $SERVER: "
runuser -l "$USER" -c "$DAEMON $SERVER -c /home/codem/node_modules/codem-transcode/config/server-IP_3000.json

LOG_FILE &" && echo_success || echo_failure
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
else
echo "$SERVER is locked."
RETVAL=1
fi
}
do_stop()
{
echo -n $"Stopping $SERVER: "
pid=ps -aefw | grep "$DAEMON $SERVER" | grep -v " grep " | awk '{print $2}'
kill -9 $pid > /dev/null 2>&1 && echo_success || echo_failure
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}

case "$1" in
start)
do_start
;;
stop)
;;
restart)
do_stop
do_start
;;
*)
echo "Usage: $0 {start|stop|restart}"
RETVAL=1
esac

exit $RETVAL

Database configuration using port isn't working

When using PostgreSQL as database i need to specified the port because postgres running on port 5432 so my configuration would be look like :

{
    "port":            8080,
    "access_log":      "/var/log/access.log",
    "database":{
      "dialect": "postgres",
      "username": "user",
      "password": "pass",
      "database": "codem_db",
      "host": "localhost",
      "port": 5432
    },
    "slots":           8,
    "interface":       "127.0.0.1",
    "encoder":         "ffmpeg",
    "scratch_dir":     "/tmp",
    "use_scratch_dir": true,
    "ffprobe":         null
}

but unfortunately i've got exception like this :

13 Feb 00:47:05 - Started server on interface 127.0.0.1 port 8080 with pid 1577.
13 Feb 00:47:05 - Caught exception: Error: connect ECONNREFUSED
13 Feb 00:47:05 - Caught exception: Error: Connection terminated

After that i'm trying to debug on connect(port, host) function inside ../node_modules/pg/lib/connection.js, i've found wrong value on port argument is set to 3306. And then it seem inside ../node_modules/codem-transcode/lib/job.js on JobUtils.getDatabase function you're not set the port :

getDatabase: function() {
    if (JobUtils.sql == null) {
      if (config['database']['dialect'] == "sqlite") {
        JobUtils.sql = new Sequelize('database', 'username', 'password', {
          dialect: 'sqlite',
          storage: config['database']['database'],
          logging: false
        });
      } else {
        JobUtils.sql = new Sequelize(config['database']['database'], config['database']['username'], config['database']['password'], {
          dialect: config['database']['dialect'],
          storage: config['database']['database'],
          host: config['database']['host'],
          logging: false
        });
      }
    }
    return JobUtils.sql;
  }

Error after installing is generic

I've tried several times to install and configure transcodem but I only ever get a generic message when I try to add a job using the example curl commands that says {"message":"The transcoder was not able to spawn a new job."} .

Is there anyway I can get more detail about what has gone wrong with the install? (transcodem is running as I can ask it for the job list and it gives me an answer).

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.