在Android创建的AAC文件上以流模式使用ffmpeg时出现问题

时间:2018-09-27 19:06:05

标签: android ffmpeg

我正在使用userUUID = []; groupUUID = []; constructor(private http: HttpClient) {} getUserbyToken() { const option = { params: new HttpParams().set('token', this.token) }; return this.http .get<any>(`${this.baseURL}/auth/jwt/tokeninfo`, option) .pipe( switchMap(res => { if (!this.userUUID.includes(res.uuid)) { this.userUUID.push(res.uuid); } return this.http .get<any>(`${this.baseURL}/aaa/users/${res.uuid}/groups`) .pipe(map(groups => groups)); }) ) .subscribe(result => { for (let i = 0; i < result.length; i++) { if (!this.groupUUID.includes(result[i].uuid)) { this.groupUUID.push(result[i].uuid); } } console.log(this.groupUUID); console.log( this.userUUID.toString()); }); } getRoleOftheUser() { if (this.groupUUID.length > 0) { of(...this.groupUUID) .pipe( mergeMap(item => this.http .get<any>( `${this.baseURL}/aaa/groups/${item}/effectiveRolesByUser?item=${item}` ) .pipe( concatMap(id => { for (const key in id) { if (!id.hasOwnProperty(key)) { continue; } if (!this.matchUUID(key) ) { continue; } else { if (id[key] === 'ROLE_ADMIN') { return item; } else { return item; } } } }) ) ), delay(1000) ) .subscribe(result => { console.log(result); }); } } private matchUUID(value) { const stringifyUserUUID = this.userUUID.toString(); if (value === stringifyUserUUID ) { return value; } } 在Android中录制音频剪辑,将文件导出到Mac,然后尝试使用aac对其进行解码。它在文件模式下工作正常,但在流模式下失败,并出现以下错误。似乎短文件始终可以正常工作,但长文件(2分钟或更长时间)会失败。 Android {@ {1}}的错误,还是我使用ffmpeg的错误?

谢谢, Dror

ffmpeg

1 个答案:

答案 0 :(得分:0)

没关系。我想到了。 m4a文件具有一些标头信息,这些信息由Android媒体播放器放在文件末尾,因为它是流应用程序。流模式下的ffmpeg需要标头信息在文件的开头附近。使用ffmpeg -acodec copy -movflags faststart修复文件对我有用。