I have converted a video using ffmpeg.. The details of the original files was Duration: 01:31:40.81, start: 0.000000
but when i converted the video the info of converted file was Duration: 01:31:40.85, start: 0.046440
After converting the video the start: 0.000000 changed to start: 0.046440
What does it mean ? Why it got changed ? How to make both same even after converting ?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 30
Thread
-
Last edited by hss2293; 23rd Dec 2013 at 07:32.
-
I've noticed this a lot and wrote a program to show a visual indication of audio to video sync because of that but it can be caused by a LOT of things like:
1. Audio delay with to respect to video as shown by MediaInfo
2. Audio and Video being resynced like:
VVVVVVVVVVVVVV
AAAAAAAAAAAAAA (shifted .046 -> 01:31:40.81 + 00:00:00.046 = 01:31:40.856 Total V-A)
3. MediaInfo reading Metadata not the actual settings (Which it does occasionally if Meta is present)
Without actually being sure where you came from and what format, codec, information utility you used, etc. it is hard to tell.
Since the result resembles item 2 above, I'm betting on that one. Without a lot of testing, it will be equally hard to tell if that's what SHOULD have happened.
Is the Video and Audio in sync? It will be hard to tell with only .046 shift. -
Audio is padded by many encoders e.g. AAC by ~ 40ms. The value varies by sample rate and encoder. The delay in the video should keeps everything in sync (40ms is about the threshold that most people can discern anyway)
-
Depending of what the input is all about, there might also be some not decodeable frames which get ignored during reencoding and might lead to a delay.
Without infos about the source and the used ffmpeg call there are to many variables that might be the cause of the delay,... -
Yes the audio and video are in sync.. But i want to solve this issue.. I have seen many videos on other sites and tested them they all have start: 0.000000..
Is there any way to fix it ? -
-
I am using the following command
Code:ffmpeg -i filename -vcodec mpeg4 -b:v 170k -s 320x240 -acodec libfdk_aac -b:a 32k -ar 44100 -ac 1 output.3gp
-
Cqn you post the MediaInfo of the first original video. This is important since it may have original delay, uneven audio/video lengths, etc. If as I suspect, the audio/video needs to be offset, you might try taking the resulting video and run 'ffmpeg -I video.mp4 -ss 0.046 -vcodec copy -acodec copy video2.mp4. This will essentially 'trim' any projecting extra 0.046 off the front and should eliminate the need for any delay. Its worth a try and has fixed many of mine but since I do not have the original or mediainfo, we can only guess. The only way to truly tell ia to separate the audio and video to see if they are ok (equal length).
-
Here is mediainfo of original video.
Code:Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 File size : 51.4 MiB Duration : 4mn 55s Overall bit rate mode : Variable Overall bit rate : 1 459 Kbps Encoded date : UTC 2013-11-26 22:58:29 Tagged date : UTC 2013-11-26 22:58:29 gsst : 0 gstd : 295333 gssd : BADC207E2HH1386080592668708 gshh : r6---sn-p5qlsne7.googlevideo.com Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L3.1 Format settings, CABAC : Yes Format settings, ReFrames : 1 frame Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 4mn 55s Bit rate : 1 265 Kbps Maximum bit rate : 4 129 Kbps Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.055 Stream size : 44.5 MiB (87%) Tagged date : UTC 2013-11-26 22:58:33 Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 4mn 55s Bit rate mode : Variable Bit rate : 192 Kbps Maximum bit rate : 203 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 44.1 KHz Compression mode : Lossy Stream size : 6.76 MiB (13%) Title : IsoMedia File Produced by Google, 5-11-2011 Encoded date : UTC 2013-11-26 22:58:31 Tagged date : UTC 2013-11-26 22:58:33
-
That video has been downloaded, at some time, from YouTube and is variable bit rate for audio and video. I did a test and downloaded a similar video from YouTube and got the same results as you. My audio was 10ms off instead of 46. I tried the same ffmpeg script as yours except used libvo_aacenc for audio and this time it simply made the last audio frame 10ms in length to match the video.
If you wish to use the libfdk_aac then I might suggest taking your result and try trimming the first 46ms off it:
ffmpeg -i "video" -ss 0.046 -vcodec copy -acodec copy "outputTrimmed.3gp"
If that fails., try trimming the last 46ms :
ffmpeg -i "video" -vcodec copy -acodec copy -t 01:31:40.81 "outputTrimmed.3gp"
It worked for me but I do not have the libfdk_aac since I do not believe its possible to get that in Zeranoes ffmpeg builds.
I hope this will help.
UPDATE: The left video is the original. Notice the audio does not come in until 0.133 or 3rd frame.:
The video on the right is with 0.134 trimmed from the beginning. This cured the late start and it was as close to the original MediaInfo as I could get from YouTube. Hope it works.
Thanks
Budman1Last edited by Budman1; 25th Dec 2013 at 22:57. Reason: Update.
-
Is there any way to prevent this delay by adding some more options in the command line ?
-
There is probably yes but there are many here in this forum that are more knowledgeable about this than I am. All I can suggest is , with MY example, graphing the audio shows it does not start until the forth video frame or about 0.133 seconds (29.97FPS -> .0333 seconds/frame * 4 = .133) late so I could try adding -ss 0.133 AFTER the -i input. The only problem is, with my original video in MP4 format, it does not tell me that the video is late so how could I have known.
Again, I do not know why it doesn't but I would not know enough to change it originally because it does not tell me with media info. I assume its how different codecs work/decodec/package/??? You could try you original with -ss added:
ffmpeg -i filename -ss 0.046 -vcodec mpeg4 -b:v 170k -s 320x240 -acodec libfdk_aac -b:a 32k -ar 44100 -ac 1 output.3gp
By adding -ss 0.xxx AFTER the -I video it should make the seek more accurate (https://trac.ffmpeg.org/wiki/Seeking%20with%20FFmpeg) but you would only know that (if it even works) by graphing the audio or making note of the delay from the CONVERTED 3GP.
NOTE: .046 is about 21.74 FPS and since I doubt that is your frame rate on the original so where you would end up is probably more likely 2 X Frame Rate. With my example I actually ended up around 150MS seeking to 133ms as shown below. Personally I would just leave it if it truly is in sync and plays fine otherwise it will be a trial and error method unless someone has more information or your original video.
Seeking to 0.133 seconds
original, locating start of Seek result aboveLast edited by Budman1; 26th Dec 2013 at 06:27. Reason: proof reading after coffee
-
Can't help there... I DO know that if you convert it to h264/avc (libx264) it will become 3GPP Media Release 6.
ffmpeg -i filename -vcodec libx264 -b:v 170k -s 320x240 -acodec libvo_aacenc -b:a 32k -ar 44100 -ac 1 output.3gp
That is supposed to be a valid codec for 3gp but whether it will play ok, I do not know. sorry.
From WIKI:
The 3GP file format stores video streams as MPEG-4 Part 2 or H.263 or MPEG-4 Part 10 (AVC/H.264), and audio streams as AMR-NB, AMR-WB, AMR-WB+, AAC-LC, HE-AAC v1 -
But it will give me h264 codec profile.. Here is the mediainfo of 3gp file using 3gpp media release 5
Code:Format : MPEG-4 Format profile : 3GPP Media Release 5 Codec ID : 3gp5 File size : 67.6 MiB Duration : 47mn 1s Overall bit rate mode : Variable Overall bit rate : 201 Kbps Encoded date : UTC 2013-12-21 18:11:58 Tagged date : UTC 2013-12-21 18:11:58 Video ID : 1 Format : MPEG-4 Visual Format profile : Simple@L1 Format settings, BVOP : No Format settings, QPel : No Format settings, GMC : No warppoints Format settings, Matrix : Default (H.263) Codec ID : 20 Duration : 47mn 1s Bit rate mode : Variable Bit rate : 170 Kbps Maximum bit rate : 490 Kbps Width : 320 pixels Height : 240 pixels Display aspect ratio : 4:3 Frame rate mode : Constant Frame rate : 29.970 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Compression mode : Lossy Bits/(Pixel*Frame) : 0.074 Stream size : 56.2 MiB (83%) Writing library : Lavc55.12.100 Encoded date : UTC 2013-12-21 18:11:55 Tagged date : UTC 2013-12-21 18:12:01 Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : HE-AACv2 / HE-AAC / LC Codec ID : 40 Duration : 47mn 1s Bit rate mode : Variable Bit rate : 32.0 Kbps Maximum bit rate : 46.2 Kbps Channel(s) : 2 channels / 1 channel / 1 channel Channel positions : Front: L R / Front: C / Front: C Sampling rate : 44.1 KHz / 44.1 KHz / 22.05 KHz Compression mode : Lossy Stream size : 10.8 MiB (16%) Encoded date : UTC 2013-12-21 18:11:56 Tagged date : UTC 2013-12-21 18:12:01
-
No, the codec ID will be AVC1 but the codec PROFILE will be 3gp Media Release 6 in an MP4 Format.
General
Complete name : C:\Users\Bud\Desktop\outputTrimmed.3gp
Format : MPEG-4
Format profile : 3GPP Media Release 6 Basic
Codec ID : 3gp6
File size : 12.4 MiB
Duration : 2mn 35s
Overall bit rate : 671 Kbps
Movie name : New York City: A Few Clips
Movie name/More : Captured with Replay Media Catcher 5 - www.applian.com
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3.0
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=60
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 2mn 35s
Bit rate : 568 Kbps
Width : 640 pixels
Height : 360 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 29.970 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.082
Stream size : 10.5 MiB (85%)
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 2mn 35s
Bit rate mode : Constant
Bit rate : 96.0 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 1.78 MiB (14%)
AS I say, 3GP is unfamiliar ground for me, so any experts please feel free to add information. -
No one is replying to this thread except you.. I think this forum is made for helping but no one having knowledge is replying here.
-
No one is replying to this thread except you.. I think this forum is made for helping but no one having knowledge is replying here.
b. most people to not care about 3gp since they prefer mp4; so when you speak of '3GPP Media Release 5' you might have to add more details on what you exactly want so people which do not use 3gp at all can help
c. no need to answer, since Budman1 does a good job answering the questions.
d. people to have a real life and family to care about (especially over holidays)
The main questions so far were:
- "Why does ffmpeg add a delay?"
This normally happens to compensate:- Audio&Video delays might get added to compensate decoding problems. In example if the input video does start with only a part of a gop.
- New Audio&Video delays necessary due to format changes different audio formats for example have different frame/block sizes which results in different delays. Also different audio encoders create different audio delays.
- delay might be added due to container restrictions regarding some profiles/formats.
- delay might be added due to a bug (so posting which tool versions were used isn't normally a bad idea)
This was answered by Budman1, poisendeathray and myself - "Is there any way to fix it ?"
DB83 answered here, that there really isn't an issue to fix and Budman1 replied that there might be ways to 'fix' this delay.
Both replied that more infos are required.
Since you didn't provide a sample Budman1 then started to use a random file from Google and posted his experience with it. - "Is there any way to prevent this delay by adding some more options in the command line ?"
Budman1 posted a way and for positive delays one could also use something like http://superuser.com/questions/579008/add-1-second-of-silence-to-audio-through-ffmpeg - "How i can convert it using 3GPP Media Release 5 ??? "
Budman1 replied that he doesn't know since the doesn't use 3gp. Same goes for me and like mentioned above, provide more detailed infos what you want/need so others, which do not know about '3gb standard' and do not have the time to read up on it using http://www.3gpp.org/DynaReport/21101.htm can help.
-> only question that isn't answered was the last question about '3GPP Media Release 5', to figure out which settings are required the easiest way is probably to find a file which is '3GPP Media Release 5'-compatible and create content which mirrors the basic characteristics of that content.
It worked for me but I do not have the libfdk_aac since I do not believe its possible to get that in Zeranoes ffmpeg builds.
-> only legal way to get ffmpeg with libfdk aac would be to build ffmpeg yourself, in example using scripts like https://github.com/rdp/ffmpeg-windows-build-helpers
Cu Selur - "Why does ffmpeg add a delay?"
-
Code:
ffmpeg -i filename -ss 0.046 -vcodec mpeg4 -b:v 170k -s 320x240 -acodec libfdk_aac -b:a 32k -ar 44100 -ac 1 output.3gp
and
Code:ffmpeg -i filename -vcodec libx264 -b:v 170k -s 320x240 -acodec libvo_aacenc -b:a 32k -ar 44100 -ac 1 output.3gp
(even with '-profile:v baseline -level 1' MediaInfo still indicates '6 Basic', so like Budman1 thought H.264 seems to always result in '3GPP Media Release 6 Basic'.
-> no clue what requirement is triggering '3GPP Media Release 5'
since:
Code:Format : MPEG-4 Visual Format profile : Simple@L1
------------------
correction:
Code:ffmpeg -y -i filename -ss 0.046 -vcodec mpeg4 -b:v 170k -s 320x240 -g 250 -qscale 4 -mbd rd -trellis 1 -subcmp satd -strict -2 -acodec aac -b:a 48k -ar 44100 -ac 1 h:\Output\output.3gp
(found this by simply googling for 'ffmpeg 3GPP Media Release 5' and lookign at: http://geekdeck.wordpress.com/2010/01/17/encoding-video-for-cell-phones/
so a simple google search could have solved that as timely as you wanted,...
Last edited by Selur; 27th Dec 2013 at 03:06.
-
I have already tried this.. The above command creates 3GPP Media Release 4 file not 5. Here is the mediainfo of file converted by the above said command
Code:Format : MPEG-4 Format profile : 3GPP Media Release 4 Codec ID : 3gp4 File size : 12.9 MiB Duration : 4mn 21s Overall bit rate : 414 Kbps Video ID : 1 Format : MPEG-4 Visual Format profile : Simple@L1 Format settings, BVOP : No Format settings, QPel : No Format settings, GMC : No warppoints Format settings, Matrix : Default (H.263) Codec ID : 20 Duration : 4mn 21s Bit rate mode : Constant Bit rate : 361 Kbps Width : 320 pixels Height : 240 pixels Display aspect ratio : 4:3 Frame rate mode : Constant Frame rate : 24.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Compression mode : Lossy Bits/(Pixel*Frame) : 0.196 Stream size : 11.3 MiB (87%) Writing library : Lavc55.41.101 Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 4mn 21s Bit rate mode : Constant Bit rate : 48.0 Kbps Channel(s) : 2 channels Original Channel count : 1 channel Channel positions : Front: C Sampling rate : 44.1 KHz Compression mode : Lossy Stream size : 1.50 MiB (12%)
-
worked for me on one file,.. -> no clue what is needed to require "3GPP Media Release 5" instead of "3GPP Media Release 4"
Since you do not seem to know that either, you will probably either have to wait until someone who uses 3gp comes along.
quickly reading over http://ffmpeg.org/pipermail/ffmpeg-devel/2008-June/049902.html I really don't see a reason to aim for "3GPP Media Release 5" -> you probably will have to read through the specification to figure out which requirement triggers the usage of release 5 over release 4. (there might be some users using 3gp in the ffmpeg irc channel) -
I will wait for other replies and i will search also.. Thanks for the help
Code:Channel(s): 2 channels / 1 channel / 1 channel Channel positions: Front: L R / Front: C / Front: C Sampling rate : 44.1 KHz / 44.1 KHz / 22.05 KHz
-
running MediaInfo with full detail might show some additional infos, other than that:
Code:Channel(s): 2 channels / 1 channel / 1 channel Channel positions: Front: L R / Front: C / Front: C
-> if you want/need it fixed report it to the MediaInfo bug tracker and with a bit of luck the author deems the problem to be serve enough to fix it. -
If you remux it with yamb 2.1.0.0 beta 2, it will be 3GPP Media Release 5 . So probably there is an option in mp4box to do this , or that version just happened to use 3GPP Media Release 5 specs. You can look at the mp4box documentation for more info
Or you might search for an older ffmpeg build that uses Release 5 specs if new ones tend to use Release 6. The article selur linked to was published in 2010, so look around that period . I don't think ffmpeg has a switch to control what profile is used for 3gp . (note the mp4box from yamb 2.1.0.0 beta 2 was from 2009, so maybe around that period various muxers conformed to Release 5 specs)Last edited by poisondeathray; 27th Dec 2013 at 09:04.
-
Selur and PoisonDeathRay, Thanks for the great information (as always from both of you) and enough to keep ME reading for a while. The information and links have been most helpful to try to increase my knowledge. Appreciate the help!
Similar Threads
-
mp4 cut issue (ffmpeg -ss)
By leandro in forum Video ConversionReplies: 6Last Post: 26th Jan 2013, 11:56 -
reorder streams with ffmpeg issue
By MarquisdeOz in forum AudioReplies: 6Last Post: 9th Jul 2011, 13:19 -
FFMPeg Issue : Codec ID#
By Bonie81 in forum Newbie / General discussionsReplies: 0Last Post: 23rd Oct 2010, 15:10 -
ffmpeg cut mpeg2 video issue
By santhoshv in forum EditingReplies: 2Last Post: 28th Oct 2009, 01:11 -
ffmpeg cut mpeg2 video issue
By santhoshv in forum Newbie / General discussionsReplies: 2Last Post: 27th Oct 2009, 03:50