VectorLinux
October 24, 2014, 07:10:15 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Video transcodeing (solved)  (Read 5421 times)
InTheWoods
Vectorite
***
Posts: 302


« on: July 19, 2007, 04:41:58 pm »

Whenever I change a file (any format) to DVD format either with ffmpeg or with Avidemux using the Auto>> DVD function I get a video with choppy audio. This is only noticeable playing the file with Avidemux or on a standard DVD player for use with a TV ( burned DVD). MPlayer and Xine will play these files flawlessly.

some examples I have tried:
Code:
ffmpeg -i video.flv -r 29.97 -ab 128 -ar 48000 -b 1856 -aspect 4:3 -s 720x480 test.mpg
ffmpeg -i my_video.avi -target ntsc-dvd -aspect 4:3 -sameq my_dvd_video.mpg

Interestingly this
Code:
ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 test.mpg
which is the wrong format for DVD plays properly with Avidemux (I have not tried it on a burnt DVD).

Since the goal is to produce a DVD which can be played in any player I need to discover how to encode the audio properly for DVD format. Ive tried options from many sites and forums to no avail. Any one who has successfully authored a DVD please share your transcodeing know how.

« Last Edit: August 01, 2007, 06:18:47 pm by InTheWoods » Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #1 on: July 19, 2007, 04:49:08 pm »

Do you happen to be converting from XVID or DIVX to DVD?  I came up with a awesome "recipe" using mencoder.  It's on one of these partitions somewhere. 

I'll post it if you think it will be useful.
Logged
InTheWoods
Vectorite
***
Posts: 302


« Reply #2 on: July 19, 2007, 05:10:44 pm »


Please do post. That's not what I am working with now but it will be some time soon. Right now it's .flv .mpeg (not DVD specs) and .vro (from mini DVDs which I can convert to playable mpeg's for mplayer but not regular DVD's).

Logged
rbistolfi
Packager
Vectorian
****
Posts: 2288


« Reply #3 on: July 19, 2007, 05:32:21 pm »

I think the reason of this is you are using a sample rate / depth  which is not compatible with your dvd player. Try playing with those settings or read your dvd player to see the capabilities for audio. Mplayer can play those files because it can play that codec or sample rate. If the problem is you are using a wrong codec for audio encoding, you will need to find a codec compatible with your player.
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
InTheWoods
Vectorite
***
Posts: 302


« Reply #4 on: July 19, 2007, 05:43:35 pm »


That would seem logical however I have tried Avidemux's defaults I've tried Lame, tooLame, and AC3 which seems to be common for commercial DVDs. I've tried a wide variety of sample rates to no avail. I'm not to sure what you mean by depth.

What has me most confused is that the camera will play the .vro files directly to the TV and those same files are playable by Mplayer and Xine. Is it possible that the Avidemux package from the repository lacks the proper audio codec and I just think I am transcoding the audio to standard DVD format?

Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #5 on: July 20, 2007, 06:49:17 am »

Dear Lord!  I've got VL on two different computers.  One has two hard drives with 5 different VL versions, the other computer has one.  Of course the text file was among the 5.  lol

OK here's my recipe.  Keep in mind that it is set up for transcoding Xvid or Divx to NTSC DVD.  You're gonna have to pour over the mencoder docs to adjust if you need PAL.  Also note.  Most downloaded Xvid's or Divx's have the black letterbox (if any) trimmed off to make it a smaller file size.  I have it set up so that when the frame is resized to NTSC, it will fill the screen from side to side, keeping the aspect ratio, then adding equal black on top and bottom to achieve the needed height.

If the borders already exist, no harm done. It will be a bit extra wasted filtering.  The resulting DVD will use AC3 sound.  If the input.avi already has AC3 sound.  Use the "With AC3" one.  This will copy the original AC3 sound directly.  The other will convert the sound to AC3 from whatever format it is in.

I've included "HQ" versions as well.  These will take much longer to encode.  To be honest...  I don't use them.  The Xvid or Divx has already had loss in quality.  So I don't see the point.  No sense in putting lipstick on a pig, because it will still be a pig.  I find the lower quality setting to be plenty acceptable.  And even more so when using a standalone DVD player on a regular television.  A televison is so much more forgiving than a computer monitor.

Also you need to set the
Quote
vrc_maxrate, vbitrate, vrc_minrate,
to your needs.  I set them all to the same value.  Call me a fool if you want.  Most people would rather have a variable bit rate for a smaller file size.  Mencoder will often ignore your wishes and you will end up with a small file size and low quality.  I like to have the highest bitrate I can get.  I want one movie, one DVD.  I like the entire DVD used if possible.  So I set all three setting equal, at a bitrate that will completely fill the DVD.  Mencoder will honor these settings.

You can find a dependable online bitrate calculator here: http://www.videohelp.com/calc.htm

Don't change the audio bitrate (abitrate) on my recipe.  It is set to a DVD standard.
Change "infile.avi" and "outfileDVD.mpeg" to suite your needs.

Oh.... enough already, here they are.
Code:
***HQ Very slow!!!******

***If audio is already ac3****
mencoder infile.avi -of mpeg -mpegopts format=dvd -srate 48000 -ofps 30000/1001 \
-vf scale=720:,expand=720:480,harddup \
-ovc lavc -oac copy \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=6800:vbitrate=6800:vrc_minrate=6800:\
keyint=18:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:\
vqmin=1:lmin=1:dc=10:vstrict=0:aspect=4/3 \
-o outfileDVD.mpeg

****if audio is not ac3****
mencoder infile.avi -of mpeg -mpegopts format=dvd -srate 48000 -ofps 30000/1001 \
-vf scale=720:,expand=720:480,harddup \
-ovc lavc -oac lavc \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=6400:vbitrate=6400:vrc_minrate=6400:\
keyint=18:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:\
vqmin=1:lmin=1:dc=10:vstrict=0:aspect=4/3:acodec=ac3:abitrate=192 \
-o outfileDVD.mpg



***Not HQ******

***If audio is already ac3****
mencoder infile.avi -of mpeg -mpegopts format=dvd -srate 48000 -ofps 30000/1001 \
-vf scale=720:,expand=720:480,harddup \
-ovc lavc -oac copy \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=6800:vbitrate=6800:vrc_minrate=6800:\
keyint=18:trell:\
vstrict=0:aspect=4/3:dc=10 \
-o outfileDVD.mpeg

****if audio is not ac3****
mencoder infile.avi -of mpeg -mpegopts format=dvd -srate 48000 -ofps 30000/1001 \
-vf scale=720:,expand=720:480,harddup \
-ovc lavc -oac lavc \
-lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=6050:vbitrate=6050:vrc_minrate=6050:\
keyint=18:trell:dc=10:vstrict=0:aspect=4/3:acodec=ac3:abitrate=192 \
-o outfileDVD.mpg
Logged
rbistolfi
Packager
Vectorian
****
Posts: 2288


« Reply #6 on: July 20, 2007, 06:57:13 am »

Quote
I'm not to sure what you mean by depth.

Sorry, I meant the resolution, i.e., 8 bits / 16 / 24 / 32. My soundcard can encode at 192000 / 24bits, but my dvd player only support 96000 / 16 bits.

@exeter, that looks useful, thanks.
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
InTheWoods
Vectorite
***
Posts: 302


« Reply #7 on: July 24, 2007, 09:58:43 pm »


I tried your solution exeterdad but the problem remains. After many more attempts it seems that it is the video size that screws up the audio. That is to say that at the proper size, 720x480 the audio is choppy but at half size, 320x240 (352x480 with Avidemux) the audio is fine. the picture looks squashed with the Avidemux half size setting.

Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #8 on: July 25, 2007, 03:25:03 am »

I have to admit I'm surprised it didn't work for you.  What type of DVD's are you using?  DVD-R seems to be quite compatible with standalone DVD players.  Especially the older players.  What speed are you burning at?  SLOW is the best. 4x is preferred by many people.  I have to admit, I've had some weird playback burning at higher speeds.

Is there a way to try your DVD on a different standalone player?  Also your problem may have nothing to do with the actual encoding.  How it is authored can make or break whether or not the DVD will play correctly on a standalone DVD player.  What software/procedure do you use to get your MPEG file onto the DVD?
Logged
InTheWoods
Vectorite
***
Posts: 302


« Reply #9 on: July 26, 2007, 07:53:30 pm »

Quote
What type of DVD's are you using?
I used a DVD-R and authored it with DVDstyler. But right now I am just trying to get the files to play in Avidemux. They seem to play the same in it as on my DVD player.

 I found this
Quote
23,976 fps with 3:2 pulldown = 29,97 playback fps (NTSC Film, this is only supported by MPEG2 video)
Dropping the frame rate  to 23.976 makes the audio play fine.

I can't open .flv files with Avidemux nor can I change the frame rate (even though the option is there) but with ffmpeg I run this:
Code:
ffmpeg -i video.flv -r 23.976 -ab 192 -ar 48000 -b 2250 -aspect 4:3 -s 720x480 test.mpg
ffmpeg will not read the files off of my video camera which has the audio files encoded as ac3.

I have read that
Quote
Discs containing 525/60 (NTSC) video must use PCM or Dolby Digital on at least one track.
I tried adding -acodec ac3 to ffmpeg but this just results in a segmentation fault.

Right now to successfully produce a file for use on a DVD I have to use Avidemux to encode the audio then ffmpeg can read the file and change the frame rate. Finally I use Avidemux to re-encode the audio back to ac3.

Is there a way to encode audio to ac3 with ffmpeg?
Alternatively can I change the frame rate with mencoder?

Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #10 on: July 27, 2007, 04:05:59 am »

Huh?  LOL

The framerate is set by this
Quote
-ofps 30000/1001
  Which is indeed 29.97 (NTSC) 

Are you using this to convert .flv to  or .avi?  I don't know why it wouldn't work with .flv, it should. Mencoder isn't all that picky.  But I've never tried it with .flv.

I was just looking back and a something jumped out at me:
Quote
but at half size, 320x240 (352x480 with Avidemux) the audio is fine. the picture looks squashed with the Avidemux half size setting.

Is that how it looked after playing a DVD you encoded at half D-1 (352x480)?  Or were you looking directly at the mpeg file that was created.  If you were looking at it directly, the picture will look screwed up.  When the DVD is authored, there is information included to tell the standalone DVD player what size to play the video at.  The DVD player will take the distorted video and stretch it from side to side so it fits the screen.  Looks surprisingly good.  If you can get it to play smoothly at Half D-1, you may want to go for it and burn a disc to see how it works.

I wish I could be more help.  I am no pro that's for sure.  I have pages and pages of "encoding" notes from tidbits I've gleaned off of the internet during my video adventures.  But unfortunately they reside on a hard drive that started making funny noises last night.  I can't mount the drive.  Undecided
Quote
Is there a way to encode audio to ac3 with ffmpeg?

Sure can.  Just don't know how off the top of my head.  I know I've saved that snippet as well.
Logged
InTheWoods
Vectorite
***
Posts: 302


« Reply #11 on: August 01, 2007, 06:21:57 pm »

   
      I am sorry to hear about your hard drive. As much for me as you since this is my first video adventure and could probably benefit from those "recipies".

   I would like to add a bit more about the frame rate. The frame rate for film is 24fps. Interlaced PAL is 25fps and interlaced NTSC video is 29.97fps. If you have a 24fps source the encoder is supposed to embed MPEG-2 "repeat_first_field" flags into the video stream. I don't understand how the rest works but it's something like this. There is a speedup and a 2/3 pull down which for a 60Hz (59.94Hz) NTSC display results in 29.97fps displayed.

   I think therefore that my camera must be a 24fps source. Even though it records to mini-DVD's. That's why changing the frame rate, or the size which results in a frame rate change, makes the file playable. Files that do not come from my camera play just fine with the standard options including all of the NTSC size options.

   To make ffmpeg save the audio as ac3 you are supposed to add
 
Code:
-acodec <codec, ac3>
to the output file options. This did not work for me. When I add that I get no audio at all. But if you run:
Code:
ffmpeg -i my_video.avi -target ntsc-dvd -sameq my_dvd_video.mpg
This yields a same quality, 4:3, 704x480, 29.97 frame rate, with ac3 audio.
If you need to change any of these options do it after -target and -sameq.

   I think I can call this solved. Now on to DVD authoring.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!