Skip to content

Static video clip creator. Takes an image, an audio track and creates a video from it.

Notifications You must be signed in to change notification settings

sylsau/ffpodclip.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ffpodclip.sh v20230507
        Takes an image and an audio track and creates a video from it.

REQUIREMENTS
        ffmpeg, mimetype, coreutils (stat, cut)

USAGE
        ffpodclip.sh AUDIO_FILE IMAGE_FILE [-o OUTPUT_FILE -ss START_TIME -t DURATION -q CRF -s SIZE --ff-opts "FF_OPTS" --twitter-mode -y]

OPTIONS AND ARGUMENTS
        AUDIO_FILE      path to audio file (if more than 2 is provided, the last one is used)
        IMAGE_FILE      path to image file (if more than 2 is provided, the last one is used)
                        NB: The image's width and height must be divisible by 2. If it is not
			the case, the image will be resized by 1 pixel.
        OUTPUT_FILE     path to output file [default: /tmp/ffpodclip-out.mp4]
	START_TIME 	start timestamp of the audio track (ffmpeg -ss option) [default: (unset)]
	DURATION 	duration time of the audio track (ffmpeg -t option) [default: whole audio track]
        CRF             quality of the output video (constant rate factor) [default: 18]
        SIZE            size of output video (WIDTHxHEIGHT) ; specifying -1 will use a value
			that maintains the aspect ratio of the input image
			[default: (no change)]
        FF_OPTS         ffmpeg options to pass to the final command (use quotes) 
                        [default: "-c:v libx264 -framerate 1 -tune:v stillimage -preset:v fast -pix_fmt yuv420p -c:a copy"]
        --twitter-mode  add ffmpeg options for twitter compatibility; overwrite FF_OPTS
        -y              option to overwrite output file

EXAMPLE
        See Example/ directory for an example output.
        $ ffpodclip.sh example.png example.m4a -o out_example.mp4 -q 25
        $ ffpodclip.sh me_talking.opus my_painting.png -o humble_video.mkv -q 21 -s 1200x-1
        $ ffpodclip.sh pic.jpg audio.mp3 -q 15

TWITTER "MEDIA BEST PRACTICES"
        - Recommended Video Codec: H264 High Profile
        - Recommended Frame Rates: 30 FPS, 60 FPS
        - Recommended Video Resolution: 1280x720 (landscape), 720x1280 (portrait), 720x720 (square)
	- Recommended Minimum Video Bitrate: 5,000 kbps
        - Recommended Minimum Audio Bitrate: 128 kbps
        - Recommended Audio Codec: AAC LC
        - Recommended Aspect Ratio: 16:9 (landscape or portrait), 1:1 (square)

REFERENCES
	FFMPEG libx264 encoding guide: <https://trac.ffmpeg.org/wiki/Encode/H.264>
	Twitter media best practices: <https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/uploading-media/media-best-practices>

AUTHOR
        Written by Sylvain Saubier

REPORTING BUGS
        Mail at: <feedback@sylsau.com>

About

Static video clip creator. Takes an image, an audio track and creates a video from it.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published