Problem with merging audio and video

508 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

pghildiy

nieprzeczytany,
2 gru 2009, 12:48:492.12.2009
do xuggler-users
Hi
I have written code to merge audio(MP3) and video(FLV without audio);
it runs successfully but output av has somewhat inferior quality of
video.
To improve quality of video i used outputVideoCoder.setFlag
(IStreamCoder.Flags.FLAG_QSCALE, true), but if i set this flag then
resulting FLV contains only video(better quality) but doesnt produce
any audio.

Is this expected behaviour?

Regards,
Prashant

Art Clarke

nieprzeczytany,
2 gru 2009, 12:51:472.12.2009
do xuggle...@googlegroups.com
Hi Prashant,

No, that's not expected behavior.  But instead of setting QSCALE to true, try setting it to false, and then increasing the bit-rate on your video encoder.

- Art


--

You received this message because you are subscribed to the Google Groups "xuggler-users" group.
To post to this group, send email to xuggle...@googlegroups.com.
To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.





--
http://www.xuggle.com/
xu‧ggle (zŭ' gl) v. To freely encode, decode, and experience audio and video.

Use Xuggle to get the power of FFmpeg in Java.

pghildiy

nieprzeczytany,
2 gru 2009, 13:10:392.12.2009
do xuggler-users
Hi Art,
I am setting codec of output same as input video codec, also i am
using values of BitRate and other parameters from input video coder
and setting them in output video coder. The quality of video is very
poor and also its pixelated, practically of no use. :(

I increased bit rate to even 3 times that of input coder but that too
didnt improve the quality.
Are there any other levers which i can use to improve the quality of
video?

Also any pointers as to why it is not working with the QSCALE flag
will be very helpful.

Thanks
Prashant

On Dec 2, 10:51 pm, Art Clarke <acla...@xuggle.com> wrote:
> Hi Prashant,
>
> No, that's not expected behavior.  But instead of setting QSCALE to true,
> try setting it to false, and then increasing the bit-rate on your video
> encoder.
>
> - Art
>
>
>
> On Wed, Dec 2, 2009 at 9:48 AM, pghildiy <pghildiya...@gmail.com> wrote:
> > Hi
> > I have written code to merge audio(MP3) and video(FLV without audio);
> > it runs successfully but output av has somewhat inferior quality of
> > video.
> > To improve quality of video i used outputVideoCoder.setFlag
> > (IStreamCoder.Flags.FLAG_QSCALE, true), but if i set this flag then
> > resulting FLV contains only video(better quality) but doesnt produce
> > any audio.
>
> > Is this expected behaviour?
>
> > Regards,
> > Prashant
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "xuggler-users" group.
> > To post to this group, send email to xuggle...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > xuggler-user...@googlegroups.com<xuggler-users%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/xuggler-users?hl=en.
>
> --http://www.xuggle.com/

Art Clarke

nieprzeczytany,
2 gru 2009, 13:31:432.12.2009
do xuggle...@googlegroups.com

pghildiy

nieprzeczytany,
2 gru 2009, 13:58:542.12.2009
do xuggler-users
Hi Art
I checked converter.java and used same settings as in that but still
its not working. (I have my bit rate at 250000 with no benefit)
Sorry, I am newbee in field of audio and video only have java exp :)
so couldnt understand much as to what i could be doing wrong.

Can you please tell what might be going wrong with the QSCALE flag? if
somehow i can make it work with this flag it would take care of big
headache :)

Thanks
Prashant

On Dec 2, 11:31 pm, Art Clarke <acla...@xuggle.com> wrote:
> http://wiki.xuggle.com/Performance_Tuning#How_Can_I_Effect_BitRate_an...
> > <xuggler-users%2Bunsu...@googlegroups.com<xuggler-users%252Buns...@googlegroups.com>

Art Clarke

nieprzeczytany,
2 gru 2009, 14:17:572.12.2009
do xuggle...@googlegroups.com
Hi Prashant,

Don't use the QSCALE settings -- or if you do, make sure you try adjusting the GlobalQuality setting as well.  Instead, turn of QSCALE, and then play with different encoder settings.  If you're familiar with the FFmpeg command line, test with the options that work for it, and then map those to setProperty(...) calls on the IStreamCoder.

For example, coder.setProperty("b", "200000") uses the FFmpeg "b" option, but is the same as coder.setBitRate(200000);

- Art

To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.


pghildiy

nieprzeczytany,
2 gru 2009, 14:19:392.12.2009
do xuggler-users
Thanks Art,
Let me try that

~Prashant

On Dec 3, 12:17 am, Art Clarke <acla...@xuggle.com> wrote:
> Hi Prashant,
>
> > > > <xuggler-users%2Bunsu...@googlegroups.com<xuggler-users%252Buns...@googlegroups.com>
> > <xuggler-users%252Buns...@googlegroups.com<xuggler-users%25252Bun...@googlegroups.com>

pghildiy

nieprzeczytany,
3 gru 2009, 04:57:323.12.2009
do xuggler-users
Hi Art
I was able to obtain same quality of video with QSCALE flag set to
false by setting bit rate and bit rate tolerance to high value but
resultant flv didnt give any audio output.

So the situation as of now is
1) If i encode video with same bit rate as that of input video then i
get audio also but quality of video is very bad
2) if i encode with high bit rate and bit rate tolerance for video
then quality of video is good but i dont get any audio

What else can i do to get proper av output??

Regards,
Prashant

Art Clarke

nieprzeczytany,
3 gru 2009, 09:42:213.12.2009
do xuggle...@googlegroups.com
This is really strange to me.  Perhaps if you post your code (on pastebin.org with a link) I or someone else on the list might see something you're doing wrong?

- Art

To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.


pg

nieprzeczytany,
3 gru 2009, 10:25:323.12.2009
do xuggler-users

Art Clarke

nieprzeczytany,
3 gru 2009, 10:41:133.12.2009
do xuggle...@googlegroups.com
Two things I notice, one minor, one major:

minor: you're setting width and height on the output audio coder.  that's unnecessary since it's just audio.
major: you're attempting to write all the video packets from a file and then all the audio packets from a file, but telling Xuggler not to interleave (you're passing false on IContainer.writePacket).  I'm surprised the file writes any audio at all --in fact I suspect you're getting an error when you try to write your first audio packet because of 'timestamps out of order" -- check your logs.

So some general advice:
1) always walk through your code iine by line in a Debugger to see if methods are failing (e.g. returning negative numbers) when you don't expect.
2) you could just change your writePacket(...) call to ask Xuggler to interleave (pass in true).  This will likely help for small files, but due to the way you've implemented your Algorithm Xuggler would need to buffer the entire set of video packets in memory while waiting for the audio to be written.  This probably doesn't scale.  By the way, if this doesn't work for small files (let's say 10 seconds or less), then go back to step 1, and look at the return values for each method you call.
3) implement the algorithm in the correct (but more difficult) way.  That is:
  a) open each container, let's call them A and B
  b) read one packet each from A and B
  c) process both packets and get two new packets to write (let's call them A' and B').
  d) write both packets to the IContainer either in DTS order, or ask the IContainer to interleave.
  e) if A'.getDts() is < B'.getDts(), then read container A to get the next packet, else read container B to get the next packet.
  f) continue until one file is empty, and then flush out the other file.

Put another way, be clever in your code and interleave which of the two files you're reading from next to ensure that Xuggler doesn't have to buffer an entire file.

Hope that helps,

- Art

To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.


pg

nieprzeczytany,
3 gru 2009, 10:55:243.12.2009
do xuggler-users
Great thanks, it worked like a charm :) and i had been banging my head
for whole day :)
I have set interleaving to true and while reading packets from both
files simultaneously.

it is giving me warning
[flv @ 0xa404cc0] MAX_READ_SIZE:5000000 reached

how can i take care of this??

Regards,
Prashant Ghildiyal
> > > > > > > <xuggler-users%252Buns...@googlegroups.com<xuggler-users%25252Bun...@googlegroups.com>
> > <xuggler-users%25252Bun...@googlegroups.com<xuggler-users%2525252Bu...@googlegroups.com>
>
> > > > <xuggler-users%25252Bun...@googlegroups.com<xuggler-users%2525252Bu...@googlegroups.com>
> > <xuggler-users%2525252Bu...@googlegroups.com<xuggler-users%252525252B...@googlegroups.com>
>
> > > > > > > > > > > .
> > > > > > > > > > > For more options, visit this group at
> > > > > > > > > > >http://groups.google.com/group/xuggler-users?hl=en.
>
> > > > > > > > > > --http://www.xuggle.com/
> > > > > > > > > > xu‧ggle (zŭ' gl) v. To freely encode, decode, and
> > experience
> > > > audio
> > > > > > > and
> > > > > > > > > > video.
>
> > > > > > > > > > Use Xuggle to get the power of FFmpeg in Java.
>
> > > > > > > > > --
>
> > > > > > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > > > Groups
> > > > > > > > > "xuggler-users" group.
> > > > > > > > > To post to this group, send email to
> > > > xuggle...@googlegroups.com.
> > > > > > > > > To unsubscribe from this group, send email to
>
> ...
>
> read more »

Art Clarke

nieprzeczytany,
3 gru 2009, 10:59:393.12.2009
do xuggle...@googlegroups.com
Hi Prashant,

That may be happening because our FFmpeg internal interleaving buffers got too full from having to cache all the VIDEO from your file.  If that's the case, see my previous e-mail on how to do this the right way.

- Art

To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.


pg

nieprzeczytany,
3 gru 2009, 13:43:513.12.2009
do xuggler-users
Thanks a ton Art, you are a life saver.

Regards,
Prashant Ghildiyal

On Dec 3, 8:59 pm, Art Clarke <acla...@xuggle.com> wrote:
> Hi Prashant,
>
> That may be happening because our FFmpeg internal interleaving buffers got
> too full from having to cache all the VIDEO from your file.  If that's the
> case, see my previous e-mail on how to do this the right way.
>
> - Art
>
> ...
>
> read more »
Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0