| Author |
Message |
andrewb758 Member
Joined: 28 May 2002 Location: Ohio, United States of America
|
|
What is the best codec to capture video in Linux (from a v4l card) that would yield the best results when later transcoded to MPEG? I cannot find information on using huffyuv in Linux, which is what I'd like to use.
_________________ andrewb758
OH, USA
Have a nice day!
|
|
DarkShadow Member
Joined: 15 Nov 2001 Location: Canada
|
|
Here is the command I would use to capture huffyuv in Linux. Although you may want to change the video w/h and especially the audiorate since most sound cards can't handle capturing 48000hz plus you might need oss instead of alsa
mencoder tv:// -tv driver=v4l2:norm=ntsc:fps=29.97:input=2:width=720:height=480:alsa:adevice=hw.0,0:audiorate=48000:amode=1 -oac lavc -ovc lavc -lavcopts vcodec=huffyuv:vstrict=-1:acodec=ac3:abitrate=192 -o helloworld.avi
For best quality but massive file sizes >50gb per hour plus you can't seek
mencoder tv:// -tv driver=v4l2:norm=ntsc:fps=29.97:input=2:width=720:height=480:alsa:adevice=hw.0,0:audiorate=48000:amode=1 -oac copy -ovc copy -o helloworld
|
|
andrewb758 Member
Joined: 28 May 2002 Location: Ohio, United States of America
|
|
Thanks a bunch. One final question though: In the win32 version of the huffyuv codec, you can select different compression methods, predict left, predict median, and so on. Is there any way to select compression method in this version? Or does it automatically use the best (or fastest) method? Thanks for your help!
_________________ andrewb758
OH, USA
Have a nice day!
|
|
DarkShadow Member
Joined: 15 Nov 2001 Location: Canada
|
|
I have not played with the setting much but to see some that may apply just type "man mencoder" and scroll down to the codec specific encoding options and in there the lavc section.
Plus I forgot to mention the huffyuv outputted from that command will not work in Windows. but has the advantage of same quality but 33% SMALLER.
for Windows compatable output just change "-lavcopts vcodec=huffyuv:vstrict=1:formate=422P:acodec=ac3:abitrate=192" the picture will be compatable with the official windows decoder
|
|
trumpf Member
Joined: 28 Nov 2003
|
|
| andrewb758 wrote: |
| What is the best codec to capture video in Linux (from a v4l card) that would yield the best results when later transcoded to MPEG? I cannot find information on using huffyuv in Linux, which is what I'd like to use. |
I wonder why ffmpeg isn't always used for jobs like this. I'm only using ffmpeg because it is able to do everything I want.
For capturing videos from an v4l card just do a
ffmpeg -vd /dev/video0 -vcodec mpeg2video -b 2000 -maxrate 3000 -minrate 500 -acodec mp2 -ab 128 output.mpg
and you have the captured data already in MPEG format.
Or is there anything wrong with ffmpeg ? Why is it used so rarely ?
I have a P3-667 MHz linux box and ffmpeg converts a mpeg file as fast as my P4-2.4 GHz windows box using Tmpgenc.
|
|
DarkShadow Member
Joined: 15 Nov 2001 Location: Canada
|
|
[quote="trumpf"]
ffmpeg -vd /dev/video0 -vcodec mpeg2video -b 2000 -maxrate 3000 -minrate 500 -acodec mp2 -ab 128 output.mpg
and you have the captured data already in MPEG format.
Or is there anything wrong with ffmpeg ? Why is it used so rarely ?
I have a P3-667 MHz linux box and ffmpeg converts a mpeg file as fast as my P4-2.4 GHz windows box using Tmpgenc.[/quote
Last I checked which was not that long ago ffmpeg did not honour the max bitrate which means that the files where out of compliance and as a result when trying to make DVD's would give hundreds of buffer under-run errors that cause problems with alot of DVD players
|
|
trumpf Member
Joined: 28 Nov 2003
|
|
| DarkShadow wrote: |
Last I checked which was not that long ago ffmpeg did not honour the max bitrate which means that the files where out of compliance and as a result when trying to make DVD's would give hundreds of buffer under-run errors that cause problems with alot of DVD players |
Do you mean the bitrate problem where the generated mpeg files report a too high bitrate from 104857 kbps ?
I had that problem too but I tested some settings and that bug has dissappeard now. I noticed that as long as I use minrate and maxrate settings and don#t use the -sameq switch then the bitrate is ok. I use ffmpeg mostly to convert my mpeg files to dvd compliant files. Then I burn them with DVD-lab. DVD-lab shows no errors importing the files and they play very well on my standalone DVD-player.
And ffmpeg is really lightning fast compared to other Linux tools I tried.
|
|
cyrofilho Member
Joined: 22 Aug 2003
|
|
Really man,
If ffmpeg is much faster than tmpgenc i have to try it. I have some dv files captured from my canon camcorder (dv type2) already edited. What command would i use to ffmpeg convert the video to mpeg2 format (dvd compilant - 7000 kbps) and the audio with ffmpeg or other tool to ac3 format. I want to have 2 files, one with only the video part and the other with only the audio part. Let's suppose the file name of the captured and edited movie is "movie.avi".
Tanks very much for the information, if this works, i will only need a good authoring tool for linux to erase windows from my hard drive.
Tanks again.
Ps: With ffmpeg version are you running? And the quality of the encoded movie with ffmpeg is as good as the quality of a encoded file with tmpgenc??
Cyro
|
|
trumpf Member
Joined: 28 Nov 2003
|
|
| cyrofilho wrote: |
Really man,
If ffmpeg is much faster than tmpgenc i have to try it. I have some dv files captured from my canon camcorder (dv type2) already edited. What command would i use to ffmpeg convert the video to mpeg2 format (dvd compilant - 7000 kbps) and the audio with ffmpeg or other tool to ac3 format. I want to have 2 files, one with only the video part and the other with only the audio part. Let's suppose the file name of the captured and edited movie is "movie.avi".
Tanks very much for the information, if this works, i will only need a good authoring tool for linux to erase windows from my hard drive.
Tanks again.
Ps: With ffmpeg version are you running? And the quality of the encoded movie with ffmpeg is as good as the quality of a encoded file with tmpgenc??
Cyro |
I tried different versions of ffmpeg (0.46 - 0.48 and a CVS version)
Maybe you should just try some versions with some short files and find the one which gives the best result for you. I would say that the quality of ffmpeg converted files is really great and you should check the documentation of ffmpeg. There are a lot more switches than the one I use.
I never use ac3 but ffmpeg supports ac3 so you have to try it yourself or use google but to convert a avi to DVD compliant files I would use something like this:
ffmpeg -i movie.avi -vcodec mpeg2video -b 7000 -maxrate 9000 -minrate 1000 -s 704x576 -r 25 -aspect 16:9 -hq -acodec ac3 -ar 48000 -ab 224 -ac 2 outputfile.mpg
-i your input file
-vcodec the output videocodec
-b 7000 your desired bitrate
-maxrate depends on the quality of your source files
-minrate same as above
-s any frame size you want
-r I'm in PAL country
-aspect depends on your TV
-hq activate high quality settings
-acodec output audio codec
-ar 48000 for DVD compliant audio files
-ab audio bitrate
-ac number of audio channels
outputfile.mpg
This should give you a mpeg file. I never tried to use ffmpeg to generate seperate files for audio and video but demuxing them should be easy. I would also test some different bitrate settings. I don't know if your cam is able to do such high bitrates. Maybe you get the same result with a bitrate of 3500. Converting a 3500 bitrate source file to a 7000 bitrate file doesn't make much sense, but this certainly depends on your cam.
|
|
pn0i Member
Joined: 23 Aug 2003
|
|
hey, i wanna convert this avi (divx) to svcd. i checked out the ffmpeg syntax on their website and tried ffmpeg -target svcd input.avi output.mpeg but it -target wasn't an acceptable paramter/flag. how do i go about converting this to svcd?
|
|
trumpf Member
Joined: 28 Nov 2003
|
|
check my previous post and change the ffmpeg parameters according to this link http://www.dvdrhelp.com/svcd depending on what you want (NTSC/PAL)
the -target svcd is a nice feature, but it's not working on my ffmpeg version.
|
|
pn0i Member
Joined: 23 Aug 2003
|
|
what about adding subtitles from srt or sub?
|
|
BlkPoohba Member
Joined: 20 May 2003 Location: New Jersey
|
|
I get this error when trying to use that command. I also get it if I try to use -i video.avi
# ffmpeg -vd /dev/video0 -vcodec mpeg2video -b 2000 -maxrate 3000 -minrate 500 -acodec mp2 -ab 128 output.mpg
ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
built on Jul 11 2004 21:26:09, gcc: 3.3.2 20040108 (Red Hat Linux 3.3.2-6)
File 'output.mpg' already exists. Overwrite ? [y/N] y
Input #0, video4linux, from '':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 160x128, 25.00 fps
Input #1, audio_device, from '':
Duration: N/A, bitrate: N/A
Stream #1.0: Audio: pcm_s16le, 44101 Hz, mono, 705 kb/s
Output #0, mpeg, to 'output.mpg':
Stream #0.0: Video: mpeg2video, 160x128, 25.00 fps, q=2-31, 2000 kb/s
Stream #0.1: Audio: mp2, 44100 Hz, mono, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #1.0 -> #0.1
[mpeg2video @ 0x82ba990]a vbv buffer size is needed, for encoding with a maximum bitrate
Error while opening codec for stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
|
|
BlkPoohba Member
Joined: 20 May 2003 Location: New Jersey
|
|
and i get this when i try to change my avi file.:
$ ffmpeg -i uncut-07-09-2004-03:34-00:30:00.avi -vcodec mpeg2video -b 7000 -maxrate 9000 -minrate 1000 -s 704x576 -r 25 -aspect 16:9 -hq -acodec ac3 -ar 48000 -ab 224 -ac 2 outputfile.mpg
ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
built on Jul 11 2004 21:26:09, gcc: 3.3.2 20040108 (Red Hat Linux 3.3.2-6)
Input #0, avi, from 'uncut-07-09-2004-03:34-00:30:00.avi':
Duration: 00:10:02.4, bitrate: 42284 kb/s
Stream #0.0: Video: mjpeg, 560x420, 24.00 fps
Stream #0.1: Audio: pcm_s16le, 44100 Hz, mono, 705 kb/s
Output #0, mpeg, to 'outputfile.mpg':
Stream #0.0: Video: mpeg2video (hq), 704x576, 25.00 fps, q=2-31, 7000 kb/s
Stream #0.1: Audio: ac3, 48000 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
[mpeg2video @ 0x82ba990]a vbv buffer size is needed, for encoding with a maximum bitrate
Error while opening codec for stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
|
|
oddbod77 Mushhead
Joined: 20 Aug 2002 Location: Australia
|
|
The trouble is the -bufsize switch is not set, this is compounded by the fact that the documentation says the setting is in kilobits but the help in the executable says it's in kilobytes. If somebody more knowledgeable could confirm which is correct that would be appreciated.
I went ahead and assumed the executable was correct, so I then used the value of 224kB which I ripped off from the "VBV Buffer Size" setting in the TMPGEnc Plus 2.5 PAL DVD Template like so:
| Code: |
ffmpeg.exe -i "E:\My Videos\Music clips\slide1.mpg" -vcodec mpeg2video -b 7000 -maxrate 9000 -minrate 1000 -s 704x576 -r 25 -aspect 16:9 -hq -acodec ac3 -ar 48000 -ab 224 -ac 2 -bufsize 224 outputfile.mpg
|
Which resulted in a file that both TMPGEnc DVD Author and DVD-Lab accepted without so much as a warning, this is hardly a thorough test but it does work.
|
|
BlkPoohba Member
Joined: 20 May 2003 Location: New Jersey
|
|
I am unable to record in the size I want. I was trying to capture in 720x576 or 704x576 and neither work. It has the video distorted at the top an green or blue at the bottom.
ffmpeg -vd /dev/video0 -vcodec mpeg2video -b 5000 -acodec mp2 -ab 128 -t 00:39:52 output.mpg
how would I capture? it doesn't work if i try to capture at that size when using streamer either. I'm capturing from my HI8 video cam.
|
|
trumpf Member
Joined: 28 Nov 2003
|
|
| trumpf wrote: |
the -target svcd is a nice feature, but it's not working on my ffmpeg version. |
With the latest ffmpeg 0.4.9pre1 the -target switch is working and it just became better and faster. I use it for encoding my DVcam videos from avi to DVD compliant MPEG files with AC3 and it gives real great results.
|
|
|
|