[英]FFMPEG drops supposedly corrupt frames from original video while transcoding using h264 encoder
I am using h264 for optimising MP4 for web. 我正在使用h264来优化Web的MP4。 I have a video which has some supposedly corrupt frame(s) within it's initial 1-2 seconds. 我有一个视频,在最初的1-2秒之内有一些可能损坏的帧。 (Frame provided below) (下面提供了框架)
On transcoding using : 在使用以下代码进行转码时:
ffmpeg -i orig.mp4 -c:v libx264 -crf 25 -vf scale="-2:min(ih\,720)" -b:v 600K -g 90 -c:a libfdk_aac output.mp4
The output MP4 has these frames dropped out and I have my output with it's start about 1 to 2 seconds delayed from original video, thus resulting in overall less time duration in output video. 输出MP4的这些帧丢失了,我的输出开始比原始视频延迟了大约1到2秒,因此总体上减少了输出视频的持续时间。
Moreover, most media players also skip these frames in playback (like quicktime player, etc). 此外,大多数媒体播放器也会在播放时跳过这些帧(例如quicktime播放器等)。 But VLC media player was able to play this video without skipping these frames. 但是VLC媒体播放器能够播放此视频而不会跳过这些帧。
Is there a way to not drop frames using ffmpeg? 有没有一种方法可以不使用ffmpeg删除帧? And if possible is it possible to identify and fix these frames in a video? 如果可能,是否可以在视频中识别并修复这些帧?
Note: I tried encoding same video using AWS Elastic transcoder which actually fixed these frames (Frame provided below) : 注意:我尝试使用实际上修复了这些帧(以下提供的帧)的AWS Elastic转码器对同一视频进行编码:
Note: Original video can be found here - https://drive.google.com/file/d/0B9VkhR9Zu60ybXFDeno3RGpQTUE/view?usp=sharing Video transcoded by AWS Elsatic transcoder can be found here - https://drive.google.com/file/d/0B9VkhR9Zu60yWUVHQk5MTk05QVk/view?usp=sharing 注:原始视频可以在这里找到- https://drive.google.com/file/d/0B9VkhR9Zu60ybXFDeno3RGpQTUE/view?usp=sharing视频转码通过AWS Elsatic转码器可以在这里找到- https://drive.google.com /文件/ d / 0B9VkhR9Zu60yWUVHQk5MTk05QVk /视图?USP =共享
EDIT1: As suggested by @Mulvya in comments, TS-transcoded video can be found here - ( https://drive.google.com/file/d/0B9VkhR9Zu60yU0t6T0dMME9ZMmc/view?usp=sharing ) EDIT1:如@Mulvya在评论中所建议,可以在此处找到经过TS转换的视频-( https://drive.google.com/file/d/0B9VkhR9Zu60yU0t6T0dMME9ZMmc/view?usp=sharing )
Your source video has some frames without timestamps. 您的源视频有些帧没有时间戳。
In this particular case, extracting to raw bitstream and then transcoding works: 在这种特殊情况下,提取到原始比特流然后进行转码是可行的:
ffmpeg -i orig.mp4 -c copy orig.264
ffmpeg -i orig.264 -i orig.mp4 -map 0 -map 1:a -c:v libx264 -crf 25 -vf scale="-2:min(ih\,720)" -b:v 600K -g 90 -c:a libfdk_aac output.mp4
ffmpeg -i VID_1550287359485.mp4 -vcodec copy -an -bsf:v h264_mp4toannexb raw2.h264
ffmpeg -framerate 24 -i raw2.h264 -c copy output-a.mp4
ffmpeg -i VID_1550287359485.mp4 -b:a 192K -vn music2.mp3
ffprobe -i music2.mp3 -show_entries format=duration -v quiet -print_format json
ffprobe -i output-a.mp4 -show_entries format=duration -v quiet -print_format json
ffmpeg -i music2.mp3 -filter:a atempo="0.827415438" new-latest2.mp3
ffmpeg -i output-a.mp4 -vf "transpose=2" output-new.mp4
ffmpeg -i output-new.mp4 -i new-latest2.mp3 -c:v libx264 -c:a aac -strict experimental -shortest output-second.mp4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.