[Reprinted] [important] ask the experts for some simple questions about FFMPEG and mencoder.

Source: Internet
Author: User

There are too many cool people here. Come and ask.
I am using the FFMPEG and mencoder command line encoding.ProgramSome Problems
Why does FFMPEG use the-SS and-T parameters to capture video clips and encapsulate them in MP4 format? However, if the video is encapsulated as MKV, the video will not be synchronized. However, when the first 1st frames of the video are static for a period of time, the video will start playing synchronously when the approximate audio arrives, wait about a few seconds at. Because I need to encapsulate it as MP4 now, is there any way to enable MP4 to have a similar MKV processing method? Can we provide detailed parameters for this practice? There are also FFMPEG x264 input parameters. I want to use xforwaropts to input a string containing the preset parameter and other parameters. However, if FFMPEG has an error, it always says "Maybe incorrect Parameters ", is preset an incorrect parameter? However, I can use the xforwarencopts of mencoder to input preset as a field.
There are also some problems with mencoder. I feel that the video produced by mencoder is not very good for my eyes. It feels a little stiff and FFmpeg is good, it's more gentle. Maybe the core of the player I'm used to using is ffdshow. It has a lot to do with FFMPEG. Is there a filter that can achieve a similar effect of FFMPEG output? In addition, mencoder also has some bugs. Some videos-after OVC copy are produced, there are actually some mosaics. At first they thought it was a frame speed problem, but I adjusted the frame speed without any changes, there is always a mosaic at a certain time, not too many, but I use FFMPEG for conversion. There is no problem in the same time period. Why?
Thank you for your help...

  Top

0

   
  • Reply

  • Blooming on Ridge

  • Zj262144
  • 98 fans
  • Grade 4 7
  •  

2nd floor

Why does FFMPEG use the-SS and-T parameters to capture video clips and encapsulate them in MP4 format? --------------------------------------------- Because FFMPEG intercepts video and audio respectively, video is limited in accuracy due to key frames, and audio can be precisely cut, which leads to such a situation.
Try cutting with mp4box

  • Reply

  • Ash_mood
  • Two fans
  • Kindergarten 2
  •  

Third floor

In fact, what I want to say is, can I only use FFMPEG without other tools? There are a lot of FFMPEG parameters, and this problem only occurs in MP4 encapsulation. On MKV, 1st frames are static for a period of time, waiting for audio and then synchronizing, I want MP4 to do the same way as MKV. The parameter complexity is also good. The most important thing is that I can only use the FFMPEG command line.

  • Reply

  • Roo_zhou
  • Fifth grade 8
  •  

4th floor

The method mentioned above is good. I have also considered it before, so that the player or container does not need to support anything like audio delay and video delay. However, you need to change FFMPEG.Code, The official team should not use this kind of thing, so they can only write their own compilation.

  • Reply

  • Ash_mood
  • Two fans
  • Kindergarten 2
  •  

5th floor

In fact, the FFMPEG Code does not need to be modified. After my constant search, I finally found that a parameter can synchronize audio and video, which is similar to the MKV encapsulation, pause for a while and wait for the key frame to play the audio and video simultaneously at the beginning. Of course this is not perfect, but it is done at last, that is, the-copyinkf parameter (copy initial non-keyframes ), you can simply add this parameter, which is very simple.
In fact, I just want to find a parameter. I don't know what code I wrote and compiled by myself. The official stuff has actually been taken into consideration, but the FFMPEG parameter is often too complicated, no one will take a closer look

  • 2011-10-01 23:57
  • Reply

  • Blooming on Ridge

  • Zj262144
  • 98 fans
  • Grade 4 7
  •  

6th Floor

Reference ash_mood (5th floor)

In fact, the FFMPEG Code does not need to be modified. After my constant search, I finally found that a parameter can synchronize audio and video, which is similar to the MKV encapsulation, pause for a while and wait for the key frame to play the audio and video simultaneously at the beginning. Of course this is not perfect, but it is done at last, that is, the-copyinkf parameter (copy initial non-keyframes ), you can simply add this parameter...

This will cause other more serious problems.
You can press a video with only the initial frame being IDR. You can use this parameter to intercept the middle part and play it again. Then you will know what I mean.

  • Reply

  • Ash_mood
  • Two fans
  • Kindergarten 2
  •  

7 th floor

Reference zj262144 (6th floor)

In this case, you can press a video with only the initial frame being IDR, use this parameter to intercept the middle part, and play the video again. Then you will know what I mean.

What will happen? Will it be blurred? I don't know how to press a video with only the initial frame being IDR. I'm really not familiar with these video technologies... However, this parameter is also a problem. When the-SS parameter is placed before the-I input file (because you do not need to wait for video seeking),-copyinkf will become invalid and will not be synchronized.

  • Reply

  • Blooming on Ridge

  • Zj262144
  • 98 fans
  • Grade 4 7
  •  

8 th floor

FFmpeg-I "% ~ 1 "-vcodec libx264-xw.opts keyint = infinite: scenecut = 0-acodec copy-y" % ~ Dpn0000.mp4"
In this way, only the first frame of the video is IDR.
Of course, I just gave an extreme example to illustrate the possible problems introduced by copyinkf during interception.

  • Reply

  • ash_mood
  • two fans
  • kindergarten 2

9th floor

reference zj262144 (8 floor)

FFMPEG-I "% ~ 1 "-vcodec libx264-xw.opts keyint = infinite: scenecut = 0-acodec copy-y" % ~ In this way, only the first frame of the video is IDR. Of course, I just gave an extreme example to illustrate the possible introduction of copyinkf during video capturing.

I have pressed a video whose first frame is IDR for testing, however, after the screenshot is converted twice, no problem is found during playback. The screenshot time and the number of seconds are correct, I know what you mean now (I don't know if it's accurate), and the frames behind this IDR frame are based on their reference, this type of video requires a very slow drag time, because all frames from the IDR frame to the specified time must be reprocessed, I think the problem you mentioned is that after adding copyinkf after the second encoding, even if the SS parameter is added, it will always start playing from the IDR frame, rather than starting playing from the specified time... however, after my tests, this problem did not occur, except for the slow encoding time (because I want to re-process the IDR frame to the specified time frame, no problem

  • Reply

  • blooming on the ridge

  • zj262144
  • 98 fans
  • grade 7

10th floor

reference ash_mood (9th floor)

I have pressed a video whose first frame is IDR for testing. However, no problem is found during playback after the second conversion, the screenshot time and the number of seconds are correct, and there are no issues such as screen casting or non-synchronization. Now I know what you mean (I don't know if it is accurate ), the frames behind the IDR frame are all based on their reference. The drag time of this video is very slow, because it takes the time from the IDR frame to the specified time...

the parameter indicates that only such a video is encoded in this way.
I mean that the video is then intercepted.
---- it's okay to recode and intercept at the same time, however, the speed is quite slow, and the quality is also lost. In this way, the meaning of pure interception is lost ...... Of course, it doesn't matter if you have no problem.

  • reply

  • Ash_mood
  • Two fans
  • Kindergarten 2
  •  

11 th floor

Oh, it turns out that this is the meaning. I used to re-code the video. Now I have intercepted the video directly without re-encoding. I found that the video is black and the audio is intercepted normally, however, most of my requirements are secondary conversions rather than direct interceptions, which is acceptable. However, these videos are really extreme and should be rare. I 'd like to know, if the code of FFmpeg is modified, it is impossible to intercept such videos without re-encoding, will it also hurt the quality of the video?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.