Page 206 of 236 FirstFirst ... 106156196204205206207208216 ... LastLast
Results 2,051 to 2,060 of 2358

Thread: HOWTO: Install and use the latest FFmpeg and x264

  1. #2051
    Join Date
    Oct 2011
    Beans
    78
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by FakeOutdoorsman View Post
    You can use a "for loop" (example) or I think you can create a custom preset in WinFF and then use that to select and encode all of the files.


    The problem with most sites that give examples is that they don't keep up with FFmpeg development, but that would be an incredible task as development is very active. This forum (and this thread in particular), the #ffmpeg IRC channel, and the ffmpeg-user mailing list are all good resources.


    You can output to any existing directory (assuming you have proper permissions and can write to the desired directory).


    It's a good one, and in theory should be kept up to date, but it's not always very easy to understand and can seem overwhelming. Another is FFmpeg FAQ.
    Your posts are very valuable. I am currently practicing.
    This is what I have come up with.

    ffmpeg -i 00001.MTS -ab 320k -c:v mpeg2video -qscale 12 -r 25 -sn output5.mkv

    and

    ffmpeg -i 00001.MTS -c:v mpeg2video -qscale 15 -r 25 -sn output5.mkv

    I am not getting how I can bring the audio bitrate down. It is 1439 k. I had tried -ab 320k and -b:a 320 k. I have a feeling that qscale overpowers this function? Before I convert the folder, I need to learn these various commands.
    I hope you are around.

  2. #2052
    Join Date
    Aug 2008
    Beans
    6

    Re: HOWTO: Install and use the latest FFmpeg and x264

    First of all - thanks to the OP for an awesome post. I found it very useful.

    I have a Dell Precision 490 workstation, running Ubuntu 11.10, with two dual core Xeon 5160 CPUs (so 2 physical CPUs, with 2 cores each), which I am using to encode TV recordings (MPEG2) to H264 using ffmpeg & x264. ffmpeg is encoding at approx 180fps and everything works well, but CPU usage is little low, hovering around 30% per core, when I would expect close to 100%. Anyone know why this is?

    These are the inputs I'm giving ffmpeg

    Code:
    time ffmpeg -i ch31.m2t -s 640x360 -acodec libfaac -ac 1 -ar 44100 -b:a 56k -vcodec libx264 -preset superfast -b:v 744k ch31_superfast_800.mp4
    Output of uname -a

    Code:
    Linux dell 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
    Output of grep -i core /proc/cpuinfo

    Code:
    core id		: 0
    cpu cores	: 2
    core id		: 0
    cpu cores	: 2
    core id		: 1
    cpu cores	: 2
    core id		: 1
    cpu cores	: 2
    Output of mpstat -P ALL

    Code:
    Linux 3.0.0-14-generic (dell) 	18/12/11 	_x86_64_	(4 CPU)
    
    15:46:52     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
    15:46:52     all   16.37   10.29    1.20    3.46    0.00    0.13    0.00    0.00   68.54
    15:46:52       0   21.43   10.91    1.74    1.06    0.00    0.39    0.00    0.00   64.47
    15:46:52       1   15.64    9.95    1.08    5.29    0.00    0.07    0.00    0.00   67.97
    15:46:52       2   14.65   10.29    1.03    5.88    0.00    0.03    0.00    0.00   68.11
    15:46:52       3   13.79   10.03    0.97    1.59    0.00    0.02    0.00    0.00   73.60

    Output of top whilst ffmpeg is running

    Code:
    top - 15:35:59 up  1:11,  3 users,  load average: 0.00, 0.15, 0.29
    Tasks: 162 total,   2 running, 159 sleeping,   0 stopped,   1 zombie
    Cpu0  : 29.9%us,  1.7%sy, 31.6%ni, 36.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu1  : 30.4%us,  1.3%sy, 25.8%ni, 42.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu2  : 38.7%us,  2.0%sy, 22.7%ni, 36.0%id,  0.7%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu3  : 27.2%us,  1.0%sy, 27.9%ni, 43.5%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:   4056484k total,  3939144k used,   117340k free,    16532k buffers
    Swap:  4190204k total,     9348k used,  4180856k free,  3024616k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                              
     3559 decrypti  20   0  321m  91m 4708 R  240  2.3  45:52.11 ffmpeg

  3. #2053
    Join Date
    Oct 2011
    Beans
    78
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: HOWTO: Install and use the latest FFmpeg and x264

    FakeOutdoorsman, hello. (please, anyone is welcome to provide inputs)
    From whatever I have managed to grasp, I have formed this.

    for f in *.MTS; do ffmpeg -i "$f" -ab 320k -b:v 10000k -c:v mpeg2video -r 25 -sn "${f%.MTS}.mkv"; done
    It is working as I just checked. Do you think this is good?
    Should I go for a higher bitrate if I want to put video on DVD?
    And any other information I may have missed?


    Thank you. I have made a log of my learning. It includes experiments with ffmpeg.

  4. #2054
    Join Date
    Dec 2005
    Location
    St. Petersburg, FL
    Beans
    531
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by katya_sehgal View Post
    FakeOutdoorsman, hello. (please, anyone is welcome to provide inputs)
    From whatever I have managed to grasp, I have formed this.



    It is working as I just checked. Do you think this is good?
    Should I go for a higher bitrate if I want to put video on DVD?
    And any other information I may have missed?


    Thank you. I have made a log of my learning. It includes experiments with ffmpeg.
    The bitrates used in the command given above are already non-compliant; higher bitrates would still be non-compliant. Authoring programs that are worth using will reject streams like that, and even if they did allow it to go through, actual DVD players would likely choke on such streams.

    To quote Wikipedia (emphasis mine):
    DVD-Video discs have a raw bitrate of 11.08 Mbit/s, with a 1.0 Mbit/s overhead, leaving a payload bitrate of 10.08 Mbit/s. Of this, up to 3.36 Mbit/s can be used for subtitles and a maximum of 9.80 Mbit/s can be split amongst audio and video. In the case of multiple angles the data is stored interleaved, and so there's a bitrate penalty leading to a max bitrate of 8 Mbit/s per angle to compensate for additional seek time. This limit is not cumulative, so each additional angle can still have up to 8 Mbit/s of bitrate available.
    That means that the listed values above that come to 10320kbps are 520kbps over the cumulative limit for video+audio. In most cases, you shouldn't need bitrates that high for DVD anyway (although I remember ffmpeg's ratecontrol for MPEG-2 being rather unpleasant, but still).

    Even just going from my normal MPEG-2 encoder (HCenc, for Windows - I use it under Wine if I'm on Linux), 6000kbps is typically more than adequate for the video stream. I'd drop the audio bitrate too; my rule of thumb there is 192kbps for 2 channels, and either 384kbps or 448kbps for 5.1 (as all three of those values are what you typically see for AC-3 streams on professional DVDs).

    And why are you outputting to MKV? If you're using MPEG-2, just use .mpg (which should get understood as being MPEG-2 PS, although it may not be NAV-enabled like most DVD authoring programs like them to be).
    Last edited by qyot27; December 19th, 2011 at 03:32 AM.

  5. #2055
    Join Date
    Oct 2011
    Beans
    78
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Arrow Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by qyot27 View Post
    The bitrates used in the command given above are already non-compliant; higher bitrates would still be non-compliant. Authoring programs that are worth using will reject streams like that, and even if they did allow it to go through, actual DVD players would likely choke on such streams.

    To quote Wikipedia (emphasis mine):

    That means that the listed values above that come to 10320kbps are 520kbps over the cumulative limit for video+audio. In most cases, you shouldn't need bitrates that high for DVD anyway (although I remember ffmpeg's ratecontrol for MPEG-2 being rather unpleasant, but still).

    Even just going from my normal MPEG-2 encoder (HCenc, for Windows - I use it under Wine if I'm on Linux), 6000kbps is typically more than adequate for the video stream. I'd drop the audio bitrate too; my rule of thumb there is 192kbps for 2 channels, and either 384kbps or 448kbps for 5.1 (as all three of those values are what you typically see for AC-3 streams on professional DVDs).

    And why are you outputting to MKV? If you're using MPEG-2, just use .mpg (which should get understood as being MPEG-2 PS, although it may not be NAV-enabled like most DVD authoring programs like them to be).
    Thank you qyot27. I shall be editing on OpenShot with these clips and when they are edited, I shall convert them to the settings you have mentioned. Would that do fine?

    As for avi, it is an outdated container as I have been told. What would be the best? In Windows, I was used to avi.

    I am converting from MTS to another container so that OpenShot is smooth (as it is not with the heavy MTS files). Would my settings do for editing? Or do you suggest I edit in mpg?
    Would it be advisable to edit with my current settings and later trans-code to 6000 k.

  6. #2056
    Join Date
    Aug 2008
    Beans
    67

    Re: HOWTO: Install and use the latest FFmpeg and x264

    What will be command-line or bash-script for batch encoding for all video files in one directory? f.e. for this command:

    ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 2.mp4

  7. #2057
    Join Date
    Dec 2005
    Location
    St. Petersburg, FL
    Beans
    531
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by katya_sehgal View Post
    Thank you qyot27. I shall be editing on OpenShot with these clips and when they are edited, I shall convert them to the settings you have mentioned. Would that do fine?

    As for avi, it is an outdated container as I have been told. What would be the best? In Windows, I was used to avi.

    I am converting from MTS to another container so that OpenShot is smooth (as it is not with the heavy MTS files). Would my settings do for editing? Or do you suggest I edit in mpg?
    Would it be advisable to edit with my current settings and later trans-code to 6000 k.
    For editing purposes, you should be using a lossless or high bitrate I-frame only lossy format. For those purposes, AVI is not outdated and will work just as well as other containers. The limitations of AVI only really start to show when you start working with B-frames, variable frame rate video, or variable bit rate audio - features of video formats like H.264 and audio formats like AAC and Vorbis (and MP3, although VBR was a late development there).

    My suggestion, with that in mind, is to use HuffYUV or FFV1. Normally this would be in AVI, but OpenShot might support those formats in MOV or MKV as well (it depends on how it handles opening files).

    Once the video is exported from the editing program, and you want to author a DVD, then you would convert to DVD compliant MPEG-2 video and either AC3 or MP2 audio. This would generally be put in the MPEG-2 PS container, optionally with NAV sectors since many DVD authoring programs (particularly open source ones) tend to prefer that. I don't know if ffmpeg writes NAV sectors when it outputs to .mpg, but if it doesn't, you could encode the video and audio separately and then mux them with mplex (from the mjpegtools package):
    Code:
    mplex -f8 -V input.m2v input.ac3 -o final-output.mpg
    -f8 writes NAV sectors, -V allows the container to be variable bitrate-aware, which MPEG2 generally is, especially on DVD.

  8. #2058
    Join Date
    Aug 2008
    Beans
    67

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by rulet View Post
    What will be command-line or bash-script for batch encoding for all video files in one directory? f.e. for this command:
    ffmpeg -i input1.mp4 -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 2.mp4
    I found the asnwer, the command is:

    mkdir output ; for file in *.mp4 ; do ffmpeg -i $file -acodec copy -vcodec libx264 -preset slow -tune film -profile main -crf 29 -threads 0 output/$file ; done
    Now I have a question, how to recode all avi files in one directory into mp4 with compression?

  9. #2059
    Join Date
    Sep 2006
    Beans
    3,540

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by katya_sehgal View Post
    FakeOutdoorsman, hello. (please, anyone is welcome to provide inputs)
    From whatever I have managed to grasp, I have formed this.
    Code:
    for f in *.MTS; do ffmpeg -i "$f" -ab 320k -b:v 10000k -c:v mpeg2video -r 25 -sn "${f%.MTS}.mkv"; done
    It is working as I just checked. Do you think this is good?
    Not for your workflow. For each step you want to minimize data/quality loss. That is why qyot27 and I both recommended a lossless format to edit. Imagine opening a jpg file in GIMP, editing it, and then re-saving as jpg again. Conventional jpg files are lossy and each time you edit and save a file you will reduce the quality of the output. You may not always notice a difference, but it's good to avoid this entirely if you can. The lossless format should work better in OpenShot (less jerky than the MTS) and look the same as the MTS.

    Secondly, there is no reason for you to be re-encoding the audio for your file that you will edit in OpenShot (unless OpenShot doesn't like it for some reason). My earlier examples showed how to copy the audio from the input to the output.

    Quote Originally Posted by rulet View Post
    Now I have a question, how to recode all avi files in one directory into mp4 with compression?
    Change:
    Code:
    for file in *.mp4
    to:
    Code:
    for file in *.avi

  10. #2060
    Join Date
    Oct 2011
    Beans
    78
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Arrow Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by FakeOutdoorsman View Post
    Not for your workflow. For each step you want to minimize data/quality loss. That is why qyot27 and I both recommended a lossless format to edit. Imagine opening a jpg file in GIMP, editing it, and then re-saving as jpg again. Conventional jpg files are lossy and each time you edit and save a file you will reduce the quality of the output. You may not always notice a difference, but it's good to avoid this entirely if you can. The lossless format should work better in OpenShot (less jerky than the MTS) and look the same as the MTS.

    Secondly, there is no reason for you to be re-encoding the audio for your file that you will edit in OpenShot (unless OpenShot doesn't like it for some reason). My earlier examples showed how to copy the audio from the input to the output.


    Change:
    Code:
    for file in *.mp4
    to:
    Code:
    for file in *.avi

    You have been kind Fakeoutdoorsman and qyot27. I am learning much. Over the last 2 days, I have edited a small sequence in mkv.

    I want to know if this is a ffmpeg error.


    The video lags, especially during transitions in OpenSHot. I have a feeling that it could be because of configuration. But then, I am using a 3-4 GB RAM system with good space and Intel core 2 duo.
    I am convincing a family person to consider Ubuntu on their desktop. I will check if the same error persists there.

    I read in the forums about MLT (melt) and saw that I have it in my Ubuntu. Is there anything else I am missing in ffmpeg that can prevent lagging? And would the desktop fare better?

    For each step you want to minimize data/quality loss. That is why qyot27 and I both recommended a lossless format to edit. Imagine opening a jpg file in GIMP, editing it, and then re-saving as jpg again. Conventional jpg files are lossy and each time you edit and save a file you will reduce the quality of the output. You may not always notice a difference, but it's good to avoid this entirely if you can. The lossless format should work better in OpenShot (less jerky than the MTS) and look the same as the MTS.
    A fine example.
    Is MKV (qscale 2) too heavy for laptop?

    Once the video is exported from the editing program, and you want to author a DVD, then you would convert to DVD compliant MPEG-2 video and either AC3 or MP2 audio. This would generally be put in the MPEG-2 PS container, optionally with NAV sectors since many DVD authoring programs (particularly open source ones) tend to prefer that. I don't know if ffmpeg writes NAV sectors when it outputs to .mpg, but if it doesn't, you could encode the video and audio separately and then mux them with mplex (from the mjpegtools package):
    I shall follow this once I am onto the DVD. I have made notes on this.

    Even just going from my normal MPEG-2 encoder (HCenc, for Windows - I use it under Wine if I'm on Linux), 6000kbps is typically more than adequate for the video stream. I'd drop the audio bitrate too; my rule of thumb there is 192kbps for 2 channels, and either 384kbps or 448kbps for 5.1 (as all three of those values are what you typically see for AC-3 streams on professional DVDs).
    So many people are asking about this elsewhere. This rule of thumb is useful and I will do this.

    I am happy about OpenShot. And if it runs smoothly, it will help the digital medium.
    If the lag problem is not of ffmpeg, then I will seek some change in hardware. Do let me know.
    Cheers.

Page 206 of 236 FirstFirst ... 106156196204205206207208216 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •