我正在尝试连接两个文件,第一个文件有音频和视频,第二个文件只有视频。我使用以下ffmpeg
命令:
ffmpeg_command = ["ffmpeg", "-f", "concat", "-safe", "0", "-i", "clips_to_join.txt", "-vcodec", "copy", "-acodec", "copy", output_file_path] # output_filename = ch0X-start_time-end_time
p = subprocess.Popen(ffmpeg_command)
p.communicate()
但是我收到以下错误:
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Invalid UE golomb code
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1394700] Auto-inserting h264_mp4toannexb bitstream filter
Invalid UE golomb code
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, concat, from 'clips_to_join.txt':
Duration: N/A, start: 0.000000, bitrate: 5954 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 5894 kb/s, 14.06 fps, 30 tbr, 90k tbn, 180k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: pcm_alaw (alaw / 0x77616C61), 8000 Hz, 1 channels, s16, 64 kb/s
Metadata:
handler_name : SoundHandler
[mp4 @ 0x13b16e0] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x13b16e0] Codec for stream 1 does not use global headers but container format requires global headers
[mp4 @ 0x13b16e0] Could not find tag for codec pcm_alaw in stream #1, codec not currently supported in container
Output #0, mp4, to '/path/ch1-20171109-131750-131949-101000000000-padded.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 5894 kb/s, 14.06 fps, 30 tbr, 90k tbn, 90k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: pcm_alaw (alaw / 0x77616C61), 8000 Hz, mono, 64 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument