Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th May 2019, 13:52   #1  |  Link
mbcd
Registered User
 
Join Date: Dec 2008
Location: Germany
Posts: 173
Delay audio by decding with FFMPEG and / or fill up end with silence

Not found some correct or working commands.

Which command do I need to delay (positiv/negative) an audio stream I am decoding into another format (uncompressed).
There is no video inside, only audio.

And appended question:
Is there a way to fill up the end of this audio with silence to some defined total-length of audiostream or trim it to that total-length:

1:27min real-length
1:30min wanted total-length
0:03min silence added to end

1:36min real-length
1:30min wanted total-length
0:06min trimmed from end
mbcd is offline   Reply With Quote
Old 16th May 2019, 14:42   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,570
Quote:
Originally Posted by mbcd View Post
Which command do I need to delay (positiv/negative) an audio stream I am decoding into another format (uncompressed).
Positive 2.5 seconds try: -itsoffset 2.5
Negative 2.5 seconds try: -ss 00:02.500

Quote:
Originally Posted by mbcd View Post
And appended question:
Is there a way to fill up the end of this audio with silence to some defined total-length of audiostream or trim it to that total-length:

1:27min real-length
1:30min wanted total-length
0:03min silence added to end
Try: -longest

Quote:
Originally Posted by mbcd View Post
1:36min real-length
1:30min wanted total-length
0:06min trimmed from end
Try: -shortest
sneaker_ger is offline   Reply With Quote
Old 16th May 2019, 14:58   #3  |  Link
mbcd
Registered User
 
Join Date: Dec 2008
Location: Germany
Posts: 173
Thank you very much for this hints, but they not seem to work.

-itsoffset does not make any change, a "10.0" should give a 10 second delay, but nothing is applied, its still exact like the original. This command seems only to work if you have a container and sync video with audio.

-ss works, but thats only the trimming part at beginning.

-longest / shortest needs seperate streams as input as i suggest. I have only one single stream and wand to apply silense at the end or trim the end.

I tried with flac and wav as output, input is dts or ac3.

BTW: using Windows!

Last edited by mbcd; 16th May 2019 at 15:21.
mbcd is offline   Reply With Quote
Old 16th May 2019, 23:56   #4  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,570
I see.

For delay (silence at beginning) try adelay filter. For silence at end try apad filter. To cut short use -to (similar to -ss).



P.S.: delaycut can losslessly do such operations on ac3 and dts, and it is easy to use. Maybe it is of interest to you.
sneaker_ger is offline   Reply With Quote
Old 17th May 2019, 21:30   #5  |  Link
mbcd
Registered User
 
Join Date: Dec 2008
Location: Germany
Posts: 173
Thank you very much for your time, you were faster ... :-)

I came to the same conclusion, apad and adelay with apad=whole_dur there is a wonderfull command to define the total playtime.

For delay you have to specify each channel seperate, this is possible but "bad", but not a big problem, but you have to know the amount of channels before, dont unsterstand why there is no general delay for all channels.

-t is also possible for trimming to a total length.


delaycut looks nice, but I convert it to wave, also it should not be possible to cut dts-ma with it, but a nice hint, some years passed since I used it last time, is a great program!
mbcd is offline   Reply With Quote
Old 18th May 2019, 08:48   #6  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,570
Quote:
Originally Posted by mbcd View Post
For delay you have to specify each channel seperate, this is possible but "bad", but not a big problem, but you have to know the amount of channels before, dont unsterstand why there is no general delay for all channels.
Yes, it's very .. peculiar.

But at least:
Quote:
You can use adelay='5|5|5|5|5|5|5|5|5'.. up to very high number.
Unused entries are ignored.
https://trac.ffmpeg.org/ticket/5855#comment:4
sneaker_ger is offline   Reply With Quote
Old 14th December 2019, 07:34   #7  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
This is what I got from Superuser.com on the internet. How to input an audio delay in FFMpeg.

Quote:
ffmpeg.exe -i "movie.mp4" -itsoffset 3.84 -i "movie.mp4" -map 0:v -map 1:a -c copy "movie-audio-delayed.mp4" #this will offset the audio by 3.84 seconds.
Put it in my FFMpeg script to convert to xvid and mp3.

Quote:
"C:\Users\jack5\OneDrive\Desktop\ffmpeg\bin\ffmpeg.exe" -i "D:\Avisynth Scripts\Donald Duck 1\title08.xvid.avs" -itsoffset -0.197 -i "D:\Avisynth Scripts\Donald Duck 1\title08.xvid.avs" -map 0:v -map 1:a -vf "setsar=1/1" -c:v libxvid -vtag xvid -gmc 1 -me_quality 6 -mbd rd -variance_aq 1 -qscale:v 5 -c:a libmp3lame -b:a 128k "C:\Users\jack5\Videos\Final\Donald's Better Self test.avi"
Seems to work, but it's hard to completely tell with the cartoons I'm working on right now.

Last edited by Logan9778; 14th December 2019 at 07:42.
Logan9778 is offline   Reply With Quote
Old 14th December 2019, 11:39   #8  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,158
@Logan9778

Like mbcd say the -itsoffset parameter only add a delay over the audio track in a container.
To delay audio inserting silence at the begining you can use adelay with the new sintax for all channels:

-af adelay=delays=2500:all=1

It is possible also delay many audio streams without decode with eac3to (better than delaycut).
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 16th December 2019, 00:09   #9  |  Link
Logan9778
Registered User
 
Join Date: Mar 2017
Posts: 114
Ah, cool.

So, this would set it to 0 delay, since your filling in silence at the beginning, right? Then I wouldn't have to worry about the delay anymore, which would be nice.
Logan9778 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.