LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Lower video quality with ffmpeg? (https://www.linuxquestions.org/questions/linux-general-1/lower-video-quality-with-ffmpeg-4175452127/)

anon109 02-28-2013 01:57 PM

Lower video quality with ffmpeg?
 
I have a video in heigh quality I would like to play on my netbook, but it's chopy. I'm thinking my netbook doesn't have to power to play it. How can I lower the quality so my netbook will play it?

Code:

>ffmpeg -i Avata.mp4
ffmpeg version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:03:14 with gcc 4.6.3

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (5000000/104271) -> 23.98 (24000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Avatar.mp4':
  Metadata:
    major_brand    : isom
    minor_version  : 1
    compatible_brands: isomavc1
    creation_time  : 2011-08-23 18:27:53
  Duration: 02:51:31.94, start: 0.000000, bitrate: 3336 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1920x864 [PAR 8:9 DAR 160:81], 2927 kb/s, PAR 853:960 DAR 853:432, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Metadata:
      creation_time  : 2011-08-23 18:27:53
    Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 404 kb/s
    Metadata:
      creation_time  : 2011-08-23 18:29:52


Dman58 02-28-2013 04:07 PM

Not sure exactly the proper syntax but maybe something like:

Code:

ffmpeg -i /path/to/avatar.mp4 -s 1366x768 /location/for/converted/avatar.mpg
The -s option will change the output resolution of the original file. Might want to play around with that some. But this will take time to convert and maybe not worth your time.

I'm not at my linux machine so unable to test it but this should get you going. Check the man page for detailed info.

Code:

man ffmpeg
What application are you using to play this file? VLC is very good as it supports many av formats. Also mplayer, xine, dragon player might work.

Another app choice is 'avplay'

Keep us posted, good luck!

anon109 02-28-2013 06:22 PM

I've been using vlc and totem. The command you gave me is not working.

Code:

ffmpeg -i Avatar.mp4  -s 1366x768 Avatar-lower.mpg                                                                <-- ~/Media
ffmpeg version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:03:14 with gcc 4.6.3

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (5000000/104271) -> 23.98 (24000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Avatar.mp4':
  Metadata:
    major_brand    : isom
    minor_version  : 1
    compatible_brands: isomavc1
    creation_time  : 2011-08-23 18:27:53
  Duration: 02:51:31.94, start: 0.000000, bitrate: 3336 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1920x864 [PAR 8:9 DAR 160:81], 2927 kb/s, PAR 853:960 DAR 853:432, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Metadata:
      creation_time  : 2011-08-23 18:27:53
    Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 404 kb/s
    Metadata:
      creation_time  : 2011-08-23 18:29:52
[buffer @ 0x850afe0] w:1920 h:864 pixfmt:yuv420p
[scale @ 0x85027c0] w:1920 h:864 fmt:yuv420p -> w:1366 h:768 fmt:yuv420p flags:0x4
[mp2 @ 0x8501fa0] encoding 6 channel(s) is not allowed in mp2
Output #0, mpeg, to 'Avatar-lower.mpg':
    Stream #0.0(und): Video: mpeg1video, yuv420p, 1366x768 [PAR 6824:6147 DAR 853:432], q=2-31, 200 kb/s, 90k tbn, 23.98 tbc
    Metadata:
      creation_time  : 2011-08-23 18:27:53
    Stream #0.1(eng): Audio: mp2, 48000 Hz, 5.1, s16, 128 kb/s
    Metadata:
      creation_time  : 2011-08-23 18:29:52
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

Looks to me the problem is '[mp2 @ 0x8501fa0] encoding 6 channel(s) is not allowed in mp2'. Any ideas?

fortran 02-28-2013 11:54 PM

Lower the quality means?
Do you want to reduce the resolution or reduce the size?
Try this
Code:

ffmpeg -i "Avatar.mp4" -f mp4 -vcodec mpeg4 -b 512k -r 30 -s 640x360 -acodec libfaac -ar 32000 -ab 128k -ac 2 -threads 8 "Avatar_out.mp4"
-b = video bit rate, lesser the value, lesser the size of the video. But it reduces the quality of video. If you put it 256k, you can see the video is pixelette.
-s = resolution of the video, 640x360 is common resolution for mobiles. but it should be according to aspect ratio. If you put it here anything, it gives error.

H_TeXMeX_H 03-01-2013 02:20 AM

My first recommendation is to try the multi-threaded decoding in mplayer:

Code:

mplayer -vo xv -af volnorm=1 -subfont-autoscale 1 -lavdopts threads=4 -idx movie.mp4
If that doesn't do it, then convert it like:

Code:

ffmpeg -i input.mkv -vcodec libx264 -vpre special -crf 15 -s 640x288 -aspect 16:9 -r 23.976 -threads 4 -acodec libvo_aacenc -ab 128k -ar 48000 -async 48000 -ac 2 -scodec copy output.mkv
preset:
Code:

coder=1
flags=+loop
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=hex
subq=6
me_range=16
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=1
qcomp=0.6
qmin=10
qmax=51
qdiff=4
bf=3
refs=5
trellis=1
wpredp=2



All times are GMT -5. The time now is 03:47 PM.