You are not logged in.

#1 2013-08-18 03:03:43

Konstantin_hu
Banned
Registered: 2012-05-14
Posts: 84
Website

Script to encode jpg and mp3 into video for youtube?

Hi!

Sometimes I upload music and stand-up to youtube. Till now I used wine + avisynth + virtualdubmod to achieve this. Lately I realized that there is another smipler way to carry out things: ffmpeg
I was looking for some script or one-liner which makes the encoding task, but unfortunately none of those mentioned scripts worked. They are all obsolate that are mentioned by others. Some of them works, but the resulting video are denied by youtube. Do anybody know a simple one-liner or script (or maybe a handy application) which can do the transcoding the right way?

Offline

#2 2013-08-18 22:48:30

teckk
Member
Registered: 2013-02-21
Posts: 525

Re: Script to encode jpg and mp3 into video for youtube?

You don't say if you want 1 or multiple .jpg images in the video.
http://www.ffmpeg.org/trac/ffmpeg/wiki/ … m%20images

Script to encode jpg and mp3 into video for youtube?

With x264/mp3 into a mp4 container? Any number of ways. Here are some examples.

ffmpeg -r 1 -i file.jpg -i file13.mp3 -c:a copy -c:v libx264 -b:v 500k ouput.mp4
ffmpeg -loop 1 -i  file.jpg -c:v libx264 -t 30 -i file.mp3 -c:a copy out.mp4
ffmpeg -f image2 -i file.jpg -i audio.mp3 -c:a copy -c:v libx264 -b:v 500k output.mp4

Find out how you want to do, then if you want a script to automate it, something like

#! /usr/bin/env bash

echo "What image file?"
read image
echo "What audio file?"
read audio
echo "what video size?"
echo "Example: 640x480"
read size
echo "Output file name?"
read name
ffmpeg -f image2 -i "$image" -i "$audio" -c:a copy -c:v libx264 -b:v 500k -s "$size" "$name".mp4
exit

If you want to use multiple images, look at ffmpeg docs.

Last edited by teckk (2013-08-18 22:49:36)

Offline

#3 2013-08-19 01:17:39

Thaodan
Member
From: Dortmund, Nordrein-Westfalen
Registered: 2012-04-28
Posts: 448

Re: Script to encode jpg and mp3 into video for youtube?

to download the video you can use youtube-dl (its inclued in community). I wrote a script to mostly that what you need except the jpg thing:
https://gist.github.com/Thaodan/6265008


Linux odin 3.13.1-pf #1 SMP PREEMPT Wed Mar 5 21:47:28 CET 2014 x86_64 GNU/Linux

Offline

Board footer

Powered by FluxBB