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!
+ Reply to Thread
Results 1 to 3 of 3
-
-
Number_of_frames * frame_time
use bc for floating point in bash
http://linux.byexamples.com/archives/42/command-line-calculator-bc/ -
Thanks MJ Peg! I wasn't aware of BC. I just checked and it is already installed on my system.
Similar Threads
-
v2mp command line not changing output file location
By Wakewatcher in forum SVCD2DVD & VOB2MPGReplies: 8Last Post: 18th Jan 2011, 13:20 -
When using eac3to in the command line, where is the destination file create
By godoy in forum AudioReplies: 1Last Post: 4th Nov 2010, 21:30 -
command line tool to automatically cut avi file in HALF
By Choller in forum EditingReplies: 2Last Post: 1st Jan 2010, 02:19 -
Command line tool to demultiplex video
By lovyagin in forum EditingReplies: 6Last Post: 20th Dec 2009, 12:43 -
Join MOV Video from command line
By parisisal in forum EditingReplies: 4Last Post: 19th Feb 2009, 10:59