Anyone know command line FFmpeg for Xvid & Ac3?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

So to get only one input file, join the vobs first... Or join the avis afterwards...

Any suggestions as to what to do that with? cp or maybe dd ?

User avatar
gposil
Posts: 1300
Joined: Mon 06 Apr 2009, 10:00
Location: Stanthorpe (The Granite Belt), QLD, Australia
Contact:

#17 Post by gposil »

to join video files...
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by merely concatenating them.

Hence you may concatenate your multimedia files by first transcoding them to these privileged formats, then using the humble cat command (or the equally humble copy under Windows), and finally transcoding back to your format of choice.

ffmpeg -i input1.avi -sameq intermediate1.mpg
ffmpeg -i input2.avi -sameq intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -sameq output.avi

Notice that you should either use -sameq or set a reasonably high bitrate for your intermediate and output files, if you want to preserve video quality.

Also notice that you may avoid the huge intermediate files by taking advantage of named pipes, should your platform support it:

mkfifo intermediate1.mpg
mkfifo intermediate2.mpg
ffmpeg -i input1.avi -sameq -y intermediate1.mpg < /dev/null &
ffmpeg -i input2.avi -sameq -y intermediate2.mpg < /dev/null &
cat intermediate1.mpg intermediate2.mpg |\
ffmpeg -f mpeg -i - -sameq -vcodec mpeg4 -acodec libmp3lame output.avi

Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also allow concatenation, and the transcoding step is almost lossless.

For example, let's say we want to join two FLV files into an output.flv file:

mkfifo temp1.a
mkfifo temp1.v
mkfifo temp2.a
mkfifo temp2.v
mkfifo all.a
mkfifo all.v
ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null &
ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null &
ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
ffmpeg -i input2.flv -an -f yuv4mpegpipe - > temp2.v < /dev/null &
cat temp1.a temp2.a > all.a &
cat temp1.v temp2.v > all.v &
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
-f yuv4mpegpipe -i all.v \
-sameq -y output.flv
rm temp[12].[av] all.[av]
From the manual.....

In other words, after you read all that...vobs, being just mpeg2 video with ac3 audio, you should be able to just cat them together then use ffmpeg to convert the result to avi....
[img]http://gposil.netne.net/images/tlp80.gif[/img] [url=http://www.dpup.org][b]Dpup Home[/b][/url]

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#18 Post by Makoto »

Actually, not quite. That's the same as saying you can rename a .vob to .mpg/.mpeg without any problems. It may work for you, but then, it may just as likely not work. There's more to a .vob file than just an MPEG-2 video stream... but I don't remember exactly what. :oops:

(searches) Simple explanation from VideoHelp: . VOB = The VOB files contains the actual video,audio,subtitles and menus.

...so it can contain the bitmapped (VobSub) subtitle streams, still menu backgrounds, multiple angles, multiple audio streams, etc. - and note that a .vob doesn't necessarily contain a complete version of whatever video(s) are within it, of course.
Last edited by Makoto on Tue 03 Nov 2009, 14:12, edited 1 time in total.
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

User avatar
gposil
Posts: 1300
Joined: Mon 06 Apr 2009, 10:00
Location: Stanthorpe (The Granite Belt), QLD, Australia
Contact:

#19 Post by gposil »

Then the intelligent thing to do would be to use FFmpeg to convert the vobs to mpeg2, then join them, then convert the result to xvid...
[img]http://gposil.netne.net/images/tlp80.gif[/img] [url=http://www.dpup.org][b]Dpup Home[/b][/url]

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#20 Post by Makoto »

Could Handbrake (http://handbrake.fr/) work for transcoding the DVD files into a single video file, perhaps? I know sunburnt stated:
I`m trying to make ffmpeg work because none of the GUIs will work
...but did that include Handbrake? :)

Edit: Hmm... wonder if VOB2MPG would work under Wine...
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

User avatar
gposil
Posts: 1300
Joined: Mon 06 Apr 2009, 10:00
Location: Stanthorpe (The Granite Belt), QLD, Australia
Contact:

#21 Post by gposil »

Handbrake uses FFmpeg for that very thing...it is good but too large to include as standard Puppy feature...FFmpeg has no problems converting vobs to mpeg, or any other codec for that matter(provided you've compiled FFmpeg with the codec support you want)...

What sunburnt was getting at was creating a simple GUI to access the enormous range of features FFmpeg has...without resorting to PupFF/WinFF or Handbrake.
[img]http://gposil.netne.net/images/tlp80.gif[/img] [url=http://www.dpup.org][b]Dpup Home[/b][/url]

User avatar
Makoto
Posts: 1665
Joined: Fri 04 Sep 2009, 01:30
Location: Out wandering... maybe.

#22 Post by Makoto »

Well, yes, but I was mainly wondering if he'd tried it. :)
[ Puppy 4.3.1 JP, Frugal install ] * [ XenialPup 7.5, Frugal install ] * [XenialPup 64 7.5, Frugal install] * [ 4GB RAM | 512MB swap ]
In memory of our beloved American Eskimo puppy (1995-2010) and black Lab puppy (1997-2011).

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#23 Post by sunburnt »

I`m working with vobcopy to try to improve it at the moment.
But if I get more time and I get FFmpeg working well I may try it.
I`m thinking of a GUI that does simple conversions, not all FFmpeg`s options.
I use to make TV stuff, but not any more, now I only do full size and quality.
So V & A codec selection, bit rate or sameq ( same quality ), simple stuff.

### I need to figure out how to select the audio streams, I got Spanish...

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#24 Post by sunburnt »

gposil; Your Dpup FFmpeg combo seems to be doing what avidemux can`t.
avidemux just can`t seem to get the sync correct ever, I`ve given up on it.

I want to fine tune my command lines for a GUI I`m making, so... Qs:

1) To set file size instead of bit rate I used: -fs , but I got a 800MB file.???
I substituted -fs 1500000000 for -b. Will it take -fs 1500m or -fs 1500000k.?
Using file size is best, big movie = 2 on a DVD, smaller = 3, Animated = 4.

2) So I used -b , but for a 1,200MB file I had to use: -b 3000k !!! ... ???

3) Should I use x264 or h264 instead of Xvid, are they really much better?
264s don`t work in player boxes right now, but that will probably change.
If 264 is a good idea, what optimized command line is best for it?

Below is my command line, could you make any suggestions to improve it?

Code: Select all

ffmpeg -i /mnt/sdb5/V/Movie/-l1-2.vob -vcodec libxvid -b 3000k -acodec ac3 -ab 192k -f avi -g 300 -bf 2 /mnt/sda6/v/movie.avi

User avatar
gposil
Posts: 1300
Joined: Mon 06 Apr 2009, 10:00
Location: Stanthorpe (The Granite Belt), QLD, Australia
Contact:

#25 Post by gposil »

I find using this bitrate calculator works well for determining the right settings for -b

The format is kilobits/sec

Say for arguments sake your movie is 1 hour 30 minutes in length, and you want to limit filesize to 700Mb, your audio bitrate is 192k, then the calculator would return a require video bitrate of 869 kilobits/sec...So command line would be
ffmpeg -i /mnt/sdb5/V/Movie/-l1-2.vob -vcodec libxvid -b 869 -acodec ac3 -ab 192 -g 300 -bf 2 /mnt/sda6/v/movie.avi
and for x264 it would be
ffmpeg -i /mnt/sdb5/V/Movie/-l1-2.vob -vcodec libx264 -b 869 -acodec ac3 -ab 192 -g 300 -bf 2 /mnt/sda6/v/movie.avi
The Advantage in using x264 is the vastly reduced file size, but as you say it is not a standard in player boxes yet..although quite a few do it...

I hope that helps... :)

Cheers
Guy
[img]http://gposil.netne.net/images/tlp80.gif[/img] [url=http://www.dpup.org][b]Dpup Home[/b][/url]

Post Reply