Какова правильная команда, использующая gstreamer для преобразования mp4 в файл 264? - PullRequest
0 голосов
/ 25 марта 2020

Мой engli sh - это пул, извините!

Я использую ffmpeg и gstreamer для преобразования файла mp4 в формат 264, но выходной файл другой. Вопрос в следующем:

  • 1. Почему это разные файлы?

  • 2. Что означает level в gst-discoverer-1.0?

    Используйте ffmpeg это Codec: video/x-h264, ...... level=(string)1.2.

    Используйте gstreamer это Codec: video/x-h264, ...... level=(string)3.

  • 3. Как использовать gstreamer для преобразования правильных 264 файла?

Исходный видеофайл взят из https://github.com/notedit/media-server-go-demo/blob/master/video-mixer/public/big_buck_bunny.mp4.

команда:

gst-launch-1.0 filesrc location=big_buck_bunny.mp4 ! \
    qtdemux name=demux \
      demux.video_0 ! queue ! \
      decodebin ! \
      videoconvert ! \
      videoscale ! \
      videorate ! \
      video/x-raw,width=320,height=240,framerate=15/1,pixel-aspect-ratio=1/1,level=1.2 ! \
      x264enc bframes=0 byte-stream=true bitrate=9000 ! \
      filesink location=videogst.264

ffmpeg -i big_buck_bunny.mp4 -f h264 -vcodec libx264 -s 320x240 -bf 0 -r 15 videoffmpeg.264

выходной файл:

-rw-r--r-- 1 xxx staff 1.9M 3 25 13:39 videoffmpeg.264
-rw-r--r-- 1 xxx staff 17M 3 25 13:40 videogst.264

видео код c:

xxx@xxxs-MacBook-Pro resource %  gst-discoverer-1.0 videoffmpeg.264 -v
Analyzing file:///Users/xxx/tool/resource/videoffmpeg.264
Done discovering file:///Users/xxx/tool/resource/videoffmpeg.264

Topology:
  video: video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.2, codec_data=(buffer)0164000cffe100176764000cacb20283f420000003002000000303c1e2854901000668ebc3cb22c0
    Tags:
      视频编码: H.264 (High Profile)

    Codec:
      video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.2, codec_data=(buffer)0164000cffe100176764000cacb20283f420000003002000000303c1e2854901000668ebc3cb22c0
    Additional info:
      None
    Stream ID: 349989c8845fcc23360fb0ab02ea7510051b926669bf8f3862879823fbab6daf
    Width: 320
    Height: 240
    Depth: 24
    Frame rate: 15/1
    Pixel aspect ratio: 1/1
    Interlaced: false
    Bitrate: 0
    Max bitrate: 0

Properties:
  Duration: 0:01:32.995000000
  Seekable: yes
  Live: no
  Tags:
      视频编码: H.264 (High Profile)


xxx@xxxs-MacBook-Pro resource % gst-discoverer-1.0 videogst.264 -v
Analyzing file:///Users/xxx/tool/resource/videogst.264
Done discovering file:///Users/xxx/tool/resource/videogst.264

Topology:
  video: video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe1001d6764001eacb20283f602d4180416940000030004000003007a3c58b92001000568ebccb22c
    Tags:
      视频编码: H.264 (High Profile)

    Codec:
      video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe1001d6764001eacb20283f602d4180416940000030004000003007a3c58b92001000568ebccb22c
    Additional info:
      None
    Stream ID: fb99f4104b347e5682d52c0bd65bcee91b765e42f89ce2e3553be5d6d743a666
    Width: 320
    Height: 240
    Depth: 24
    Frame rate: 15/1
    Pixel aspect ratio: 1/1
    Interlaced: false
    Bitrate: 0
    Max bitrate: 0

Properties:
  Duration: 0:01:45.505000000
  Seekable: yes
  Live: no
  Tags:
      视频编码: H.264 (High Profile)
...