ffmpeg:复制/调整大小时如何保留输入元数据

问题描述

我希望输出文件具有与输入相同的元数据

我有两种情况:

  1. 带有图片
find . -name "*.jpg"|while read fname; do
  ffmpeg -y -i "$fname" -map_Metadata 0 -vf scale=1024:-1 ./compressed/"$fname"
done
  1. 带视频
find . -name "*.mp4"|while read fname; do
    ffmpeg -y  -i "$fname" -map_Metadata 0 -vf scale=1024:-2,setsar=1:1 -c:v libx264 -c:a copy ./compressed/"$fname"
done

在这两种情况下,元数据都丢失了(编辑设置当前日期的数据,我可以从原始文件中移动“编辑日期”)

参数 -map_Metadata 0 没有帮助

请告诉我,我应该修复什么?

更新: 添加日志块:

...
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0,mov,mp4,m4a,3gp,3g2,mj2,from './VID_20190909_163724.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-09-09T23:37:51.000000Z
    location        : +37.7277-119.5428/
    location-eng    : +37.7277-119.5428/
    com.android.version: 9
    com.android.capture.fps: 60.000000
  Duration: 00:00:26.49,start: 0.000000,bitrate: 159330 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661),yuvj420p(pc,bt470bg/bt470bg/smpte170m),3840x2160,158991 kb/s,SAR 1:1 DAR 16:9,59.91 fps,60 tbr,90k tbn,180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2019-09-09T23:37:51.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D),48000 Hz,stereo,fltp,96 kb/s (default)
    Metadata:
      creation_time   : 2019-09-09T23:37:51.000000Z
      handler_name    : SoundHandle
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop,[?] for help
[swscaler @ 0x7f93ddc4c000] deprecated pixel format used,make sure you did set range correctly
[libx264 @ 0x7f93e2021600] using SAR=1/1
[libx264 @ 0x7f93e2021600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f93e2021600] profile High,level 4.2,4:2:0,8-bit
...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)