Re: [FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality

2015-05-18 Thread John L


 To: ffmpeg-user@ffmpeg.org
 From: ceho...@ag.or.at
 Date: Mon, 18 May 2015 08:48:32 +
 Subject: Re: [FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality
 
 John L orionfyre at hotmail.com writes:
 
   Please test the following:
   $ ffmpeg -i inter.dts -rematrix_maxval 1.0 -ac 2 out.ac3
   $ ffmpeg -i inter.dts -rematrix_maxval 1.0 -ac 2 out.mp3
   $ ffmpeg -i inter.dts -rematrix_maxval 1.0 -ac 2 
   -acodec pcm_f32le out.wav
  
  I ran all three as requested, including '-loglevel debug'. 
  All three resulting files resulted in poor quality audio 
  as before.
 
 Now we are there;-)
 Hendrik says the option fixes audio for him, you 
 report it does not fix the issue...
 
 Carl Eugen

I reviewed my work on this section and I was wrong; this does in fact work and 
solve the issue i was originally having. Perhaps I had my file browser pointed 
at the wrong working folder...?

Thanks all, especially you Carl.
  
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality

2015-05-17 Thread John L
 
 Please test the following:
 $ ffmpeg -i inter.dts -rematrix_maxval 1.0 -ac 2 out.ac3
 $ ffmpeg -i inter.dts -rematrix_maxval 1.0 -ac 2 out.mp3
 $ ffmpeg -i inter.dts -rematrix_maxval 1.0 -ac 2 -acodec pcm_f32le out.wav

I ran all three as requested, including '-loglevel debug'. All three resulting 
files resulted in poor quality audio as before. the filtergraph output does 
show something different however, but the resulting audio is still terrible and 
indistinguishable from before.

[AVFilterGraph @ 0x2387f20] query_formats: 4 queried, 6 merged, 3 already done, 
0 delayed
0.414214 0.00 0.292893 0.00 0.292893 0.00 
0.00 0.414214 0.292893 0.00 0.00 0.292893 

I do appreciate your help in resolving this issue.

Just to see if it wasn't my system causing the issue I loaded up a windows XP 
vm and used the 32-bit windows binary from the ffmpeg homepage, resulting in 
the same outputs.
  
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality

2015-05-17 Thread John L


 To: ffmpeg-user@ffmpeg.org
 From: ceho...@ag.or.at
 Date: Sat, 16 May 2015 11:15:29 +
 Subject: Re: [FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality
 
 Moritz Barsnick barsnick at gmx.net writes:
 
  $ ffmpeg -loglevel debug -i inter.dts -ac 2 -c:a libmp3lame -f null -
  $ ffmpeg -loglevel debug -i inter.dts -ac 2 -c:a pcm_s16le -f null -
  You can insert other arbitrary codecs at will.
  
  The former shows a matrix:
  1.00 0.00 0.707107 0.00 0.707107 0.00
  0.00 1.00 0.707107 0.00 0.00 0.707107
  [auto-inserted resampler 0  at  0xb713840] ch:6 chl:5.1(side) 
  fmt:fltp r:48000Hz - ch:2 chl:stereo
  fmt:fltp r:48000Hz
  
  while the latter shows:
  0.414214 0.00 0.292893 0.00 0.292893 0.00
  0.00 0.414214 0.292893 0.00 0.00 0.292893
  [auto-inserted resampler 0  at  0xb3b55c0] ch:6 chl:5.1(side) 
  fmt:fltp r:48000Hz - ch:2 chl:stereo
  fmt:s16 r:48000Hz
  
  I think this may be the described behavior.
 
 If this really is the issue, it should be reproducible 
 with at least one of the command lines I proposed 
 (namely for -acodec pcm_f32le) and it is possible to 
 work-around the issue by forcing s16p as the mp3 
 encoding format. The mp3 encoder accepts fltp, s16p 
 and s32p.

Thanks Everyone. You've fixed the problem for me. When I cycle through the 
available format options for libmp3lame, the only one that makes bad audio is 
'fltp', both 's16p' and 's32p' produce a good file

 
 But I would really appreciate if somebody can confirm 
 that the issue is reproducible with pcm_f32le (and 
 neither with s16le nor s32le).
 
 Carl Eugen
 

I ran the following command line and received the following:

ffmpeg -loglevel debug -i inter.dts -c:a pcm_f32le -ac 2 -y inter-f32le.wav

[AVFilterGraph @ 0xca9d20] query_formats: 4 queried, 6 merged, 3 already done, 
0 delayed
1.00 0.00 0.707107 0.00 0.707107 0.00 
0.00 1.00 0.707107 0.00 0.00 0.707107 
[auto-inserted resampler 0 @ 0xc965c0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz - 
ch:2 chl:stereo fmt:flt r:48000Hz
-
the resulting wav file is significantly distorted, but qualitatively doesn't 
'feel' as harsh

And as you expected, both s16le nor s32le result in acceptable files for both:
ffmpeg -loglevel debug -i inter.dts -c:a pcm_s16le -ac 2 -y inter-s16le.wav
ffmpeg -loglevel debug -i inter.dts -c:a pcm_s32le -ac 2 -y inter-s32le.wav

I quickly re-encoded movies that were known to suffer from this issue using 
'-c:a libmp3lame -sample_fmt s16p' and they all result in acceptable audio 
levels.

So OFFICIALLY my problem is resolved. But I'm still curious why it would behave 
in such a way that fltp-fltp would be allowed to blow out levels so badly (i'm 
also scared to go down that rabbit hole)

Thank you to all who have contributed. I appreciate your help tremendously.
  
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


Re: [FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality

2015-05-16 Thread John L
 
 Instead, take the 5.1 and _DOWNMIX_ all tracks to a single stereo for
 the phone/tablet by declaring -acodec  -ac 2. No intermediate
 steps should be required. Consider also - Do you need pcm_s32le ?
 pcm_s16le is usual.

I fail to see how that is any different than what I am doing now. I was under 
the impression that the flags -acodec and -c:a were the same. Regardless using 
-acodec reults in identical clipping and noise generation dts-mp3. 
For reference here is the command I used:
ffmpeg -i inter.dts -acodec libmp3lame -ac 2 inter-new.mp3
The resulting mp3 file still has horrendous crackling and noise.


What I thought I stated quite clearly in my OP is the following:
5.1DTS-2.0MP3 results in horrible noise and clipping in the resulting mp3 file
5.1DTS2.0PCM-2.0MP3 does not generate the same atrocious noise. please 
reference the files I've included in the dropbox link in my OP.

inter.dts was the ripped 5.1 audio

inter-test.mp3 was encoded to 2.0mp3 format directly from 5.1dts and when 
played back on my laptop(s) (Windows, Linux, Mac; in Windows MP, ffplay, 
mplayer, vlc, xine, and more), Phones (s5,s3,iphone,htc one), tablet, ipod and 
my Sansa MP3 player all has horrific noise.

inter.mp3 was generated by converting the 5.1DTS to 2.0PCM and then the 2.0PCM 
to 2.0MP3, sounds just fine when played back on all of my devices.

I am fully aware that there should be NO NEED to use an intermediary wave 
format to downsample to stereo audio from 5.1 for a conversion to mp3. But 
that's exactly why I'm writing this problem into the group because it is NOT 
working as expected.
  
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user


[FFmpeg-user] Input 5.1 DTS, output 2.0 MP3: Atrocious Quality

2015-05-15 Thread John L
Backstory: I have a system in place to automagically convert video files to 
smaller formats/versions on request to have a sort of mobile version for my 
father who travels extensively. The purpose is so that he can fit significantly 
more videos on his tablet than if they were the high quality rips.

It all boils down to:
ffmpeg -i [input-file] -ac 2 -c:v libx264 -c:a libmp3lame -b:v 1024k -preset 
fast [output-file]

I was under the impression everything was hunky dory until I took a bunch of 
the shrunken movies on my phone on a roadtrip. A good many of the videos were 
as good as can be expected, and nothing was egregiously wrong. However on a few 
videos the audio was absolutely atrocious, blown out, clipping, and just noise 
from seemingly nowhere. 

One of the worst was Intersteller which was completely unwatchable after the 
first two minutes with all the blown out crescendos, pops, cracks, static, and 
voices of the deep adulterating the audio stream. All video files affected by 
this were 5.1DTS sources, but not all 5.1DTS were affected.

When talking with my father he said it was a frequent enough occurrence that he 
suspected it was just because I had shrunk the file so small and was an 
artifact of that. He did confirm that most videos that were affected weren't as 
bad as the Interstellar conversion.



~/testing$ ffmpeg -version
ffmpeg version 2.5.6-0ubuntu0.15.04.1 Copyright (c) 2000-2015 the FFmpeg 
developers
built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 
--build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu 
--shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu 
--enable-gpl --enable-shared --disable-stripping --enable-avresample 
--enable-avisynth --enable-ladspa --enable-libass --enable-libbluray 
--enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite 
--enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme 
--enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg 
--enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine 
--enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame 
--enable-libvorbis --enable-libwavpack --enable-libwebp --enable-libxvid 
--enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 
--enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx 
--enable-libx264 --enable-libsoxr --enable-gnut
 ls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
libavutil  54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat56. 15.102 / 56. 15.102
libavdevice56.  3.100 / 56.  3.100
libavfilter 5.  2.103 /  5.  2.103
libavresample   2.  1.  0 /  2.  1.  0
libswscale  3.  1.101 /  3.  1.101
libswresample   1.  1.100 /  1.  1.100
libpostproc53.  3.100 / 53.  3.100


To troubleshoot I copied out a particularly bad snippet of audio
ffmpeg -i Int*.mkv -vn -c copy -ss 1:30 -t 0:30 inter.dts

This audio clip is confirmed to be a good 5.1dts stream


ffmpeg -i inter.dts -ac 2 -c libmp3lame inter-test.mp3
This audio sample has the exact same audio defects as in the shrunken video 

Converting it to a stereo wave format, and then converting into an mp3:
ffmpeg -i inter.dts -ac 2 -c pcm_s32le inter.wav  ffmpeg -i inter.wav -c 
libmp3lame inter.mp3
both inter.wav and inter.mp3 are confirmed to be GOOD stereo copies of the 
audio with no defects.

https://www.dropbox.com/s/tru46zo07gcr8ve/testing.tar.gz?dl=0
This is a link to the files in question to my testing above. 
inter.dts : 30 second rip of audio from video
inter-test : dts-mp3 conversion
inter.mp3 : dts-wav-mp3 conversion

I apologize if I'm missing something glaring, but I've been unable to find any 
other instances of this issue with my google-fu. Until I have a solution I've 
already edited my services to perform this intermediary wave step work-around 
on all conversions.

Thank you for your time.
  
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user