Audio 如何使用FFmpeg从iPhone视频文件导出音频?

Audio 如何使用FFmpeg从iPhone视频文件导出音频?,audio,ffmpeg,mov,fluent-ffmpeg,Audio,Ffmpeg,Mov,Fluent Ffmpeg,更新1问题在于输入读取流。(见下表) 我正在使用fluent ffmpeg(版本:2.1.2)从作为流输入的视频文件中获取.mp3文件。createReadStream()。我将文件作为.pipe输出到remoteWriteStream ffmpeg -i pipe:0 -vn -f mp3 -acodec mp3 -movflags frag_keyframe+empty_moov pipe:1 这适用于.mp4、.webm和.mov(编解码器:prores)文件 但它不知何故不想在iPho

更新1问题在于输入读取流。(见下表)

我正在使用fluent ffmpeg(版本:2.1.2)从作为流输入的视频文件中获取.mp3文件。createReadStream()。我将文件作为.pipe输出到remoteWriteStream

ffmpeg -i pipe:0 -vn -f mp3 -acodec mp3 -movflags frag_keyframe+empty_moov pipe:1
这适用于.mp4、.webm和.mov(编解码器:prores)文件

但它不知何故不想在iPhone11中使用.mov。FFmpeg在运行上述代码时没有给我任何错误。它创建了.mp3文件,但大小只有152 B,无法播放

我检查了iPhone.mov文件,它返回以下内容:

"{ streams: 
   [ { index: 0,
       codec_name: 'hevc',
       codec_long_name: 'H.265 / HEVC (High Efficiency Video Coding)',
       profile: 'Main',
       codec_type: 'video',
       codec_time_base: '1111/33300',
       codec_tag_string: 'hvc1',
       codec_tag: '0x31637668',
       width: 1920,
       height: 1080,
       coded_width: 1920,
       coded_height: 1088,
       has_b_frames: 2,
       sample_aspect_ratio: '0:1',
       display_aspect_ratio: '0:1',
       pix_fmt: 'yuv420p',
       level: 120,
       color_range: 'tv',
       color_space: 'bt709',
       color_transfer: 'bt709',
       color_primaries: 'bt709',
       chroma_location: 'unspecified',
       field_order: 'unknown',
       timecode: 'N/A',
       refs: 1,
       id: 'N/A',
       r_frame_rate: '30000/1001',
       avg_frame_rate: '33300/1111',
       time_base: '1/600',
       start_pts: 'N/A',
       start_time: 'N/A',
       duration_ts: 6666,
       duration: 11.11,
       bit_rate: 7611708,
       max_bit_rate: 'N/A',
       bits_per_raw_sample: 'N/A',
       nb_frames: 333,
       nb_read_frames: 'N/A',
       nb_read_packets: 'N/A',
       tags: [Object],
       disposition: [Object] },
     { index: 1,
       codec_name: 'aac',
       codec_long_name: 'AAC (Advanced Audio Coding)',
       profile: 'unknown',
       codec_type: 'audio',
       codec_time_base: '1/44100',
       codec_tag_string: 'mp4a',
       codec_tag: '0x6134706d',
       sample_fmt: 'fltp',
       sample_rate: 44100,
       channels: 2,
       channel_layout: 'stereo',
       bits_per_sample: 0,
       id: 'N/A',
       r_frame_rate: '0/0',
       avg_frame_rate: '0/0',
       time_base: '1/44100',
       start_pts: 'N/A',
       start_time: 'N/A',
       duration_ts: 489951,
       duration: 11.11,
       bit_rate: 135091,
       max_bit_rate: 192000,
       bits_per_raw_sample: 'N/A',
       nb_frames: 481,
       nb_read_frames: 'N/A',
       nb_read_packets: 'N/A',
       tags: [Object],
       disposition: [Object] },
     { index: 2,
       codec_name: 'unknown',
       codec_long_name: 'unknown',
       profile: 'unknown',
       codec_type: 'data',
       codec_tag_string: 'mebx',
       codec_tag: '0x7862656d',
       id: 'N/A',
       r_frame_rate: '0/0',
       avg_frame_rate: '0/0',
       time_base: '1/600',
       start_pts: 'N/A',
       start_time: 'N/A',
       duration_ts: 6666,
       duration: 11.11,
       bit_rate: 2670,
       max_bit_rate: 'N/A',
       bits_per_raw_sample: 'N/A',
       nb_frames: 38,
       nb_read_frames: 'N/A',
       nb_read_packets: 'N/A',
       tags: [Object],
       disposition: [Object] },
     { index: 3,
       codec_name: 'unknown',
       codec_long_name: 'unknown',
       profile: 'unknown',
       codec_type: 'data',
       codec_tag_string: 'mebx',
       codec_tag: '0x7862656d',
       id: 'N/A',
       r_frame_rate: '0/0',
       avg_frame_rate: '0/0',
       time_base: '1/600',
       start_pts: 'N/A',
       start_time: 'N/A',
       duration_ts: 6666,
       duration: 11.11,
       bit_rate: 7,
       max_bit_rate: 'N/A',
       bits_per_raw_sample: 'N/A',
       nb_frames: 1,
       nb_read_frames: 'N/A',
       nb_read_packets: 'N/A',
       tags: [Object],
       disposition: [Object] },
     { index: 4,
       codec_name: 'unknown',
       codec_long_name: 'unknown',
       profile: 'unknown',
       codec_type: 'data',
       codec_tag_string: 'mebx',
       codec_tag: '0x7862656d',
       id: 'N/A',
       r_frame_rate: '0/0',
       avg_frame_rate: '0/0',
       time_base: '1/600',
       start_pts: 'N/A',
       start_time: 'N/A',
       duration_ts: 6666,
       duration: 11.11,
       bit_rate: 18117,
       max_bit_rate: 'N/A',
       bits_per_raw_sample: 'N/A',
       nb_frames: 333,
       nb_read_frames: 'N/A',
       nb_read_packets: 'N/A',
       tags: [Object],
       disposition: [Object] } ],
  format: 
   { filename: 'pipe:0',
     nb_streams: 5,
     nb_programs: 0,
     format_name: 'mov,mp4,m4a,3gp,3g2,mj2',
     format_long_name: 'QuickTime / MOV',
     start_time: 'N/A',
     duration: 11.11,
     size: 'N/A',
     bit_rate: 'N/A',
     probe_score: 100,
     tags: 
      { major_brand: 'qt  ',
        minor_version: '0',
        compatible_brands: 'qt  ',
        creation_time: '2020-01-11T12:33:36.000000Z',
        'com.apple.quicktime.make': 'Apple',
        'com.apple.quicktime.model': 'iPhone 11',
        'com.apple.quicktime.software': '13.3',
        'com.apple.quicktime.creationdate': '2020-01-11T13:33:36+0100' } },
  chapters: [] }" 
创建的.mp3文件会导致未定义的错误

我已经尝试通过ffmpeg将.mov重新编码为.mp4,然后尝试上面的代码来获得.mp3-仍然不起作用

有什么建议我可以使这项工作

谢谢


更新1 问题在于输入流!当我将文件下载到本地机器并将其作为本地文件而不是读取流输入时,它工作得非常好

我正在从google云存储桶创建流,如下所示:

const myBucket = storage.bucket('myBucket');
const remoteReadStream = myBucket.file(file).createReadStream();

由于此代码与所有其他编解码器完美配合,因此从h265文件从google cloud创建读取流时可能会出现什么问题?

共享失败命令的完整日志。@Gyan没有抛出任何错误。