如何使用 FFmpeg 将 mp4 转换为 mp4?

Gho*_*Cat 7 video ffmpeg video-conversion

我有一组 MP4 文件;他们都在我的 Ubuntu 机器上使用 VLC 进行游戏。但是当将它们复制到USB时;并想从我的电视(Grundig,28 VLE 5500WG)上播放它们的一些作品;其他没有。没有具体的错误信息;只是类似 \xe2\x80\x9c 的未知文件格式。\xe2\x80\x9d

\n\n

媒体信息(工作文件):

\n\n
Format                                   : MPEG-4\nFormat profile                           : Base Media\nCodec ID                                 : isom\nFile size                                : 368 MiB\nDuration                                 : 1h 6mn\nOverall bit rate mode                    : Variable\nOverall bit rate                         : 770 Kbps\n\nVideo\nID                                       : 1\nFormat                                   : AVC\nFormat/Info                              : Advanced Video Codec\nFormat profile                           : High@L3.1\nFormat settings, CABAC                   : Yes\nFormat settings, ReFrames                : 5 frames\nCodec ID                                 : avc1\nCodec ID/Info                            : Advanced Video Coding\nDuration                                 : 1h 6mn\nBit rate                                 : 640 Kbps\nWidth                                    : 720 pixels\nHeight                                   : 404 pixels\nDisplay aspect ratio                     : 16:9\nFrame rate mode                          : Constant\nFrame rate                               : 25.000 fps\nColor space                              : YUV\nChroma subsampling                       : 4:2:0\nBit depth                                : 8 bits\nScan type                                : Progressive\nBits/(Pixel*Frame)                       : 0.088\nStream size                              : 306 MiB (83%)\nWriting library                          : x264 core 142 r2479 dd79a61\nEncoding settings                        : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=19.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00\nMatrix coefficients                      : BT.709\n\nAudio\nID                                       : 2\nFormat                                   : AAC\nFormat/Info                              : Advanced Audio Codec\nFormat profile                           : LC\nCodec ID                                 : 40\nDuration                                 : 1h 6mn\nBit rate mode                            : Variable\nBit rate                                 : 124 Kbps\nMaximum bit rate                         : 140 Kbps\nChannel(s)                               : 2 channels\nChannel positions                        : Front: L R\nSampling rate                            : 48.0 KHz\nCompression mode                         : Lossy\nStream size                              : 59.3 MiB (16%)\n
Run Code Online (Sandbox Code Playgroud)\n\n

Mediainfo 损坏的文件:

\n\n
Format                                   : MPEG-4\nFormat profile                           : Base Media\nCodec ID                                 : isom\nFile size                                : 269 MiB\nDuration                                 : 47mn 22s\nOverall bit rate mode                    : Variable\nOverall bit rate                         : 793 Kbps\nWriting application                      : Stupid Ocelot\n\nVideo\nID                                       : 1\nFormat                                   : AVC\nFormat/Info                              : Advanced Video Codec\nFormat profile                           : High@L3.1\nFormat settings, CABAC                   : Yes\nFormat settings, ReFrames                : 5 frames\nCodec ID                                 : avc1\nCodec ID/Info                            : Advanced Video Coding\nDuration                                 : 47mn 22s\nBit rate                                 : 680 Kbps\nWidth                                    : 720 pixels\nHeight                                   : 404 pixels\nDisplay aspect ratio                     : 16:9\nFrame rate mode                          : Constant\nFrame rate                               : 25.000 fps\nColor space                              : YUV\nChroma subsampling                       : 4:2:0\nBit depth                                : 8 bits\nScan type                                : Progressive\nBits/(Pixel*Frame)                       : 0.094\nStream size                              : 231 MiB (86%)\nWriting library                          : x264 core 142 r2479 dd79a61\nEncoding settings                        : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00\nLanguage                                 : English\nMatrix coefficients                      : BT.709\n\nAudio\nID                                       : 2\nFormat                                   : AAC\nFormat/Info                              : Advanced Audio Codec\nFormat profile                           : LC\nCodec ID                                 : 40\nDuration                                 : 47mn 22s\nBit rate mode                            : Variable\nBit rate                                 : 96.0 Kbps\nMaximum bit rate                         : 110 Kbps\nChannel(s)                               : 2 channels\nChannel positions                        : Front: L R\nSampling rate                            : 48.0 KHz\nCompression mode                         : Lossy\nStream size                              : 32.5 MiB (12%)\n
Run Code Online (Sandbox Code Playgroud)\n

Gho*_*Cat 7

我想出了一种可行的方法(不确定它是否是最佳方法)。跑步

ffmpeg -i broken.mp4 -pix_fmt yuv420p -crf 18 good.mp4
Run Code Online (Sandbox Code Playgroud)

创建一个更大一点的 MP4(就质量而言可能差一点)...并且可以在我的电视机上使用。

(但我仍在寻找其他答案,如果有的话)

  • 你的解决方案也适用于我的情况(Android 屏幕录制,具有循环性帧率)。我也通过这样做解决了这个问题:“ffmpeg -ibroken.mp4fixed.mp4”,但我猜它是使用默认设置重新编码。 (2认同)