Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Implementation of audio/video transmuxing library based on FFMPEG API

License

NotificationsYou must be signed in to change notification settings

kala13x/libxmedia

Repository files navigation

MIT LicenseC/C++ CICMakeSMake

libxmedia

A cross-platform library for audio/video transmuxing, built on FFmpeg. Designed for simplicity and performance, it provides an intuitive high-level API and includes a fully functional example.

Installation

There are several ways to build and install the project but at first, thelibxutils library and theFFMPEG development packages must be installed on the system.

Using included script

After installinglibxutils andffpmeg libraries, the simplest way to build and install a project is to use the included script:

git clone https://github.com/kala13x/libxmedia.git&& ./libxmedia/build.sh --install

List options that build script supports:

  • --tool=<tool> SpecifyMakefile generation tool or use includedMakefile.
  • --install Install library and the tools after the build.
  • --cleanup Cleanup object files after build/installation.
  • --example Include example in the build.

You can either choosecmake,smake ormake as the tool argument, butcmake is recommended on platforms other than the Linux.If the tool will not be specified the script will usemake (included Makefile) as default.

Using CMake

If you have aCMake tool installed in your operating system, here is how project can be built and installed usingcmake:

git clone https://github.com/kala13x/libxmedia.gitcd libxmediacmake.&& makesudo make install

Using SMake

SMake is a simple Makefile generator tool for the Linux/Unix operating systems:

git clone https://github.com/kala13x/libxmedia.gitcd libxmediasmake&& makesudo make install

Using Makefile

The project can also be built with a pre-generatedMakefile for the Linux.

git clone https://github.com/kala13x/libxmedia.gitcd libxmediamakesudo make install

XMedia

xmedia is an example command-line tool for transcoding and remuxing media files. It allows you to convert and stream media from one format to another with various customization options.

Usage
xmedia [options]
Command-line options:
OptionSyntaxTypeDescription
-ipathstringInput file or stream path
-opathstringOutput file or stream path
-eformatstringInput format name (example: v4l2)
-fformatstringOutput format name (example: mp4)
-xformatstringVideo scale format (example: aspect)
-pformatstringVideo pixel format (example: yuv420p)
-sformatstringAudio sample format (example: s16p)
-knum:dennumber:numberVideo frame rate (example: 90000:3000)
-qnum:dennumber:numberVideo frame rate (example: 90000:3000)
-ccountnumberAudio channel count (example: 2)
-vcodecstringOutput video codec (example: h264)
-acodecstringOutput audio codec (example: mp3)
-wwidthnumberOutput video width (example: 1280)
-hheightnumberOutput video height (example: 720)
-bbytesnumberIO buffer size (default: 65536)
-ttypestringTimestamp calculation type
-mpathstringMetadata file path
-nshiftnumberFix non-motion PTS/DTS
-zCustom output handling
-lLoop transcoding/remuxing
-rRemux only
-dDebug logs
-uUsage information

Video Scale Formats

  • stretch Stretch video frames to the given resolution
  • aspect Scale video frames and protect aspect ratio
Example
xmedia -i /dev/video0 -o dump.mp4 -v h264 -p yuv420p -x aspect -w 1280 -h 720

Timestamp Calculation Types

  • calculate Calculate TS based on the elapsed time and clock rate
  • compute Compute TS based on the sample rate and time base
  • rescale Rescale original TS using av_packet_rescale_ts()
  • round Rescale original TS and round to the nearest value
  • source Use original PTS from the source stream
Example
xmedia -i input.avi -o output.mp4 -tsource

Metadata File Syntax

Metadata files allow you to specify additional information for your media. The syntax is as follows:

  • If the line consists of three sections, it will be parsed as a chapter.
  • If it consists of two sections, it will be parsed as metadata.
  • hh:mm:ss time format is used for chapter start/end time.

Metadata File Example:

00:00:00|00:00:40|Opening chapter00:00:40|00:10:32|Another chapter00:10:32|00:15:00|Final chapterComment|Created with xmediaTitle|Example metaAlbum|Examples
Example
xmedia -i file.mp4 -ro remuxed.mp4 -m meta.txt

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp