Where to cut audio by video frame?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Where to cut audio by video frame?

FFmpeg-users mailing list
Hello

 

I want to cut the audio from a scene of a movie (blu-ray 23.976 pfs).

I want to create the cut from frame 2928 to 5177.

Currently I don't know where I have to cut the audio to be accurate.

Is the given command correct?

 

ffmpeg.exe -i audio.flac -ss (2928/(24000/1001)) -t
(5177/(24000/1001))-(2928/(24000/1001)) -codec flac audio_cut.flac

ffmpeg.exe -i audio.flac -ss 122.122 -t 93.80204167 -codec flac
audio_cut.flac

 

And from the documentation I should use -ss as an output option to be
accurate. But what is with -t? As input or output?

 

Best

Felix

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Where to cut audio by video frame?

Bouke / VideoToolShed



> On 10 Oct 2019, at 18:35, Felix Muster via ffmpeg-user <[hidden email]> wrote:
>
> Hello
>
>
>
> I want to cut the audio from a scene of a movie (blu-ray 23.976 pfs).
>
> I want to create the cut from frame 2928 to 5177.
>
> Currently I don't know where I have to cut the audio to be accurate.
>
> Is the given command correct?
>
Depending on your way of calculating,, the dividing might / might not be needed.
-ss is for the start of what you want, the -t stands for the duration of the file you want as output.

Give it a go a couple of times, you’ll see. (It won’t hurt.)

Bouke




>
> ffmpeg.exe -i audio.flac -ss (2928/(24000/1001)) -t
> (5177/(24000/1001))-(2928/(24000/1001)) -codec flac audio_cut.flac
>
> ffmpeg.exe -i audio.flac -ss 122.122 -t 93.80204167 -codec flac
> audio_cut.flac
>
>
>
> And from the documentation I should use -ss as an output option to be
> accurate. But what is with -t? As input or output?
>
>
>
> Best
>
> Felix
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Where to cut audio by video frame?

kumowoon1025
In reply to this post by FFmpeg-users mailing list
> And from the documentation I should use -ss as an output option to be
> accurate. But what is with -t? As input or output?

They do different things depending on if it’s used as an input option or output option. I don’t think -ss would make a difference where you put -ss but -t is the duration, as an input option, it’s the duration of the file read, and as an output option it’s the duration of the output. With the math in your command it looks like it’s meant to be an output option. You might also want to take a look at -to.

Though I have to wonder how calculating based on frames is going to work out. It’s not in a vob, so you’re basically calculating the time in seconds it takes before the 2928’th frame in the video shows up, and getting the duration of how long (5177-2928) frames take up, all in seconds. I don’t know if I’d expect the timestamps to be synced up so nicely.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Where to cut audio by video frame?

Karen Norton
In reply to this post by FFmpeg-users mailing list
On Thu, Oct 10, 2019 at 12:41 PM Felix Muster via ffmpeg-user <
[hidden email]> wrote:

> Hello
>
>
>
> I want to cut the audio from a scene of a movie (blu-ray 23.976 pfs).
>
> I want to create the cut from frame 2928 to 5177.
>
> Currently I don't know where I have to cut the audio to be accurate.
>
> Is the given command correct?
>
>
>
> ffmpeg.exe -i audio.flac -ss (2928/(24000/1001)) -t
> (5177/(24000/1001))-(2928/(24000/1001)) -codec flac audio_cut.flac
>
> ffmpeg.exe -i audio.flac -ss 122.122 -t 93.80204167 -codec flac
> audio_cut.flac
>
>
>
> And from the documentation I should use -ss as an output option to be
> accurate. But what is with -t? As input or output?
>
>
>
> Best
>
> Felix
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".


Would it not be easier to clip the video for the duration you want (frame
2928 to 5177) and then extract the audio from that clip? I have done this
before and it worked for my needs however I didn't check to see if there
was any loss of quality in the resulting audio by doing it this way. There
didn't seem to be but I didn't do an analysis of the clip to check it's
quality because, as mentioned, the audio I pulled from the video worked for
my needs.

Cheers.


Karen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Where to cut audio by video frame?

FFmpeg-users mailing list
In reply to this post by FFmpeg-users mailing list
So what is the accurate way to cut audio by video frame?

I tried filters.
But they don‘t seem to be accurate for audio.
https://superuser.com/questions/866144/cutting-videos-at-exact-frames-with-ffmpeg-select-filter

So is the only way is to use -ss and -to and hope that timestamps are correct?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Where to cut audio by video frame?

FFmpeg-users mailing list
Audio and video stream have the same start_time

ffprobe -show_entries stream=codec_type,start_time -v 0 -of compact=p=1:nk=0 THE_GIRL_WITH_THE_DRAGON_TATTOO.Title1.mkv
stream|codec_type=video|start_time=0.000000
stream|codec_type=audio|start_time=0.000000


So is this the best way to cut frame 2928-5177 with ffmpeg:

ffmpeg.exe -i audio.flac -ss (2928/(24000/1001)) -to (5177/(24000/1001)) -codec flac audio_cut.flac
ffmpeg.exe -i audio.flac -ss 122.122 -to 215.9240417 -codec flac audio_cut.flac

Or does somebody know a better way?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".