VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    I've explained in another thread some of the tinkering I'm doing creating my own video effects, etc. I'm running into a problem ensuring that the audio doesn't get stepped on when the streams are cut and then recombined. I can cut and combine video streams flawlessly with ffmpeg and not loose or gain a frame. However, audio isn't so precise. This could create a problem when the end results are combined back together because from my own testing even a hundredth of a second of silence is noticeable. With sox I can cut and recombine audio down to the milisecond, and this to my ears at least is flawless. Unfortunately once I've cut a video stream all ffmpeg, mencoder, or transcode will tell me is the length of the stream down to the hundredth of a second. Is anyone aware of a common linux command line tool which I could use to tell how long a segment of video is down to the thousandth of a second?

    Barring this, I've thought of two possible workarounds:

    1) Determine the precise time using the frame rate of the stream. I might have to do this but I'd have to write a function to get the framrate and then do the conversions. Since bash doesn't handle floating point I find this kind of thing to be a pain.

    2) Get within 3 miliseconds by comparing the answers from ffmpeg and mencoder. From what I can tell, ffmpeg always rounds the time down, while mencoder will round up to the next hundreth when milisec is 5 or more. If both give the same answer, I could then assume the true time is the answer returned plus 2 milliseconds. If they return different answers, I could assume the true value is the ffmpeg answer plus 7 milliseconds. The problem here is if either changes the way they report the time of a file I'd be in trouble.

    I think I need to bite the bullet and do workaround 1. But I thought I'd run this past the forum in case there is something I'm not considering. Any suggestions would be greatly appreciated!
    Quote Quote  
  2. Member MJ Peg's Avatar
    Join Date
    Dec 2008
    Location
    United Kingdom
    Search Comp PM
    Number_of_frames * frame_time

    use bc for floating point in bash
    http://linux.byexamples.com/archives/42/command-line-calculator-bc/
    Quote Quote  
  3. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Thanks MJ Peg! I wasn't aware of BC. I just checked and it is already installed on my system.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!