Re: [FFmpeg-user] Extracted Audio not in Sync with Video
ffmpeg -y -i "v1-ed.mp4" -i "a1-ed.wav" -filter_complex "[1]anull[aud]; [0]fade=t=out:st=6673.87:n=24[out]" -strict experimental -shortest -map 0:v:0 -map 1:a:0 "lecture.mp4" ?? You can try using this command to see if it can solve your problem. The translation in English is: "Try canceling the fade-in and fade-out effect you added." china kaidi --Original-- From: "FFmpeg user questions" https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] ffprobe duration difference between 5.1.3 and 6.0.
Thanks for the very helpful information. Understood that this change is expected. -- Yasuo Honda On Tue, Oct 31, 2023 at 2:01 AM Nicolas Gaullier wrote: > > >ffprobe duration difference between 5.1.3 and 6.0. > > > >I'd like to know if this is an expected behavior change > > Yes, this is an expected change, > take a look at this unambiguous commit: > https://github.com/FFmpeg/FFmpeg/commit/836b8001c924deb9263b0f5b7c74ccfaab1f4fdc > > Note that your sample has an edit list which truncates the available (stts) > duration to 1s, > but other durations in the file (mvhd/mdhd/tkhd) are set to longer values - > which is wrong (according to 14496-12). > > Nicolas > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] Extracted Audio not in Sync with Video
Hi all, My use case is that I want to extract audio from a mp4, edit the audio, and then put the audio and the video back together. It works fine, but over the course of the two hour video, the audio gets out of sync with the video and falls behind it (visibly, so you can see the mouth and sound aren't in sync). I extract the audio with a command like this: ffmpeg -y -i "v1-ed.mp4" -vn "a1.wav" I edit a1.wav with audacity to create a1-ed.wav. And then combine audio and video with a command like this: ffmpeg -y -i "v1-ed.mp4" -i "a1-ed.wav" -filter_complex "[1]anull[aud]; [0]fade=t=out:st=6673.87:n=24[out]" -strict experimental -shortest -map [out] -map [aud] "lecture.mp4" Is there any easy way to make sure the audio stays sync'd through this process? Thanks, Josh ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Difference between i-frames and key frames
On 10/30/23 14:16, Nicolas Gaullier wrote: >>> On 07-10-2023 17:20, Ulf Zibis wrote: Hi, what is the difference between i-frames and key frames? And how many other frames are between i-frames or key frames in mp4 files, created with ffmpeg and with default settings? -Ulf >>> In mp4 containers I-frames are key frames.> >> >> That is not correct. Via ffprobe, I have seen I-frames that were not marked >> 'key_frame=1'. > > Firstly, the definition of what a key frame is may depend on contexts and on > peoples, > it is often a source of headaches. > If you take a look at > https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/h264_parser.c > You can see that properly signaled recovery points are tagged as keyframes, > which means you don't need an I-frame to make a keyframe (some low latency > encoders make use of this). > And you can also see that kind of things: > // heuristic to detect non marked keyframes > if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && > s->pict_type == AV_PICTURE_TYPE_I) > s->key_frame = 1; > as indeed, an I frame is not always a keyframe (long term references may be > required later for further processing). > > And, at the end, sorry for not answering your question ;) > > Nicolas Thank you, Nicolas. Note that I code, but not 'C'. Regarding 'https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/h264_parser.c' line# / 273 s->pict_type=AV_PICTURE_TYPE_I; 274 s->key_frame=0; 338 switch(nal.type) { 349 case H264_NAL_IDR_SLICE: 350 s->key_frame=1; 357 case H264_NAL_SLICE: 361 if(p->sei.recovery_point.recovery_frame_cnt>=0)s->key_frame=1; 382 if ( p->ps.sps->ref_frame_count<=1 &>ps.pps->ref_count[0]<=1 &>pict_type==AV_PICTURE_TYPE_I )s->key_frame=1; 571 } What is 's'? What is 'p'? What does '->' mean?/do? [note 1] What is 'ps'? What is 'ps.sps'? What is H264_NAL_IDR_SLICE? [note 2] What is H264_NAL_SLICE? What is recovery_point? I think I know (guess) what everything else is/means. [note 1] Yes, I think that's a pointer. Please don't waste your time explaining pointers. [note 2] I've never seen an explanation what 'NAL' means. I think what's meant is 'network adaption layer', though I don't know what it has to do with networking, so I'm probably wrong. I must say that I don't care for the code. For example, 'pict_type' is initialized to 'AV_PICTURE_TYPE_I' and there's nothing between that, and the 'switch', and the 'case' that changes it, yet the case seems to test 'pict_type==AV_PICTURE_TYPE_I'. Without knowing 'C', I nonetheless have taught 'C' codesmiths how to build state machines that have 100% coverage and are 100% testable. In my experience, almost all bugs come from 'accidental' state machines using 'unrecognized' state variables implemented by threaded ('spaghetti') code. --Mark. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Difference between i-frames and key frames
>> On 07-10-2023 17:20, Ulf Zibis wrote: >>> Hi, >>> >>> what is the difference between i-frames and key frames? >>> >>> And how many other frames are between i-frames or key frames in mp4 >>> files, created with ffmpeg and with default settings? >>> >>> -Ulf >> In mp4 containers I-frames are key frames.> > >That is not correct. Via ffprobe, I have seen I-frames that were not marked >'key_frame=1'. Firstly, the definition of what a key frame is may depend on contexts and on peoples, it is often a source of headaches. If you take a look at https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/h264_parser.c You can see that properly signaled recovery points are tagged as keyframes, which means you don't need an I-frame to make a keyframe (some low latency encoders make use of this). And you can also see that kind of things: // heuristic to detect non marked keyframes if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I) s->key_frame = 1; as indeed, an I frame is not always a keyframe (long term references may be required later for further processing). And, at the end, sorry for not answering your question ;) Nicolas ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] ffprobe duration difference between 5.1.3 and 6.0.
>ffprobe duration difference between 5.1.3 and 6.0. > >I'd like to know if this is an expected behavior change Yes, this is an expected change, take a look at this unambiguous commit: https://github.com/FFmpeg/FFmpeg/commit/836b8001c924deb9263b0f5b7c74ccfaab1f4fdc Note that your sample has an edit list which truncates the available (stts) duration to 1s, but other durations in the file (mvhd/mdhd/tkhd) are set to longer values - which is wrong (according to 14496-12). Nicolas ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".