Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find tag for codec none in stream #0, codec not currently supported in container - incorrect codec parameters ? #48

Open
userlip opened this issue Apr 29, 2020 · 4 comments

Comments

@userlip
Copy link

userlip commented Apr 29, 2020

Describe the bug
Trying to transcode an MP4 Video ( https://fuego-files.s3.eu-central-1.amazonaws.com/public/7c27c350565cf536a3de8f1e92c0448/23f6318b13cce446972ce1bf37df514/video/video.mp4 ) when I came across this error.

Edit: I have found that a similar/same error occurs when using this video ( https://fuego-files.s3.eu-central-1.amazonaws.com/public/2372b4ff89f01c95942243eb09572bd/d797b844073e642f966ed99a8ed64eb/video/video.mp4 ) which seems to be a HEVC video. Maybe that will help while debugging too.

I am using the code @aminyazdanpanah provided in Error #46 (thanks by the way!). Code works perfectly fine on most videos but I have been seeing some issues while batch processing videos and this is one I found that I cant find a fix for.

The ffmpeg command is:

ffmpeg '-y' '-i' 'video.mp4' '-bf' '1' '-keyint_min' '120' '-g' '120' '-sc_threshold' '0' '-b_strategy' '0' '-use_timeline' '1' '-use_template' '1' '-init_seg_name' 'video_init_$RepresentationID$.$ext$' '-media_seg_name' 'video_chunk_$RepresentationID$_$Number%05d$.$ext$' '-seg_duration' '2' '-hls_playlist' '1' '-f' 'dash' '-map' '0' '-b:v:0' '5075k' '-s:v:0' '640x360' '-map' '0' '-b:v:1' '6344k' '-s:v:1' '854x480' '-map' '0' '-b:v:2' '8458k' '-s:v:2' '1280x720' '-map' '0' '-b:v:3' '12688k' '-s:v:3' '1920x1080' '-c:v' 'libx264' '-strict' '-2' '/tmp/php_ffmpeg_video_streaming/video2.mpd'

Exact output that throws the error:

[mp4 @ 0x55f62b9bf580] Could not find tag for codec none in stream #0, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:12 --

To Reproduce

A) Use code from #46 and use the file i provided.
B) Download the provided video and use the ffmpeg command provided

Desktop/Server (please complete the following information):
ffmpeg version 4.2.2-1ubuntu118.04.sav0 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1
18.04

@userlip
Copy link
Author

userlip commented Apr 29, 2020

Not gonna Edit the post again because you might have already read it, but I think I found the reason.

Duration: 00:00:11.52, start: 0.000000, bitrate: 44900 kb/s Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 3840x2160, 44804 kb/s, 59.99 fps, 60 tbr, 600 tbn, 600 tbc (default) Metadata: rotate : 90 creation_time : 2019-09-20T17:51:42.000000Z handler_name : Core Media Video encoder : HEVC Side data: displaymatrix: rotation of -90.00 degrees Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 86 kb/s (default) Metadata: creation_time : 2019-09-20T17:51:42.000000Z handler_name : Core Media Audio Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2019-09-20T17:51:42.000000Z handler_name : Core Media Metadata Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2019-09-20T17:51:42.000000Z handler_name : Core Media Metadata Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (copy) Stream #0:3 -> #0:3 (copy) Stream #0:0 -> #0:4 (hevc (native) -> h264 (libx264)) Stream #0:1 -> #0:5 (copy) Stream #0:2 -> #0:6 (copy) Stream #0:3 -> #0:7 (copy) Stream #0:0 -> #0:8 (hevc (native) -> h264 (libx264)) Stream #0:1 -> #0:9 (copy) Stream #0:2 -> #0:10 (copy) Stream #0:3 -> #0:11 (copy) Stream #0:0 -> #0:12 (hevc (native) -> h264 (libx264)) Stream #0:1 -> #0:13 (copy) Stream #0:2 -> #0:14 (copy) Stream #0:3 -> #0:15 (copy) Stream #0:0 -> #0:16 (hevc (native) -> h264 (libx264)) Stream #0:1 -> #0:17 (copy) Stream #0:2 -> #0:18 (copy) Stream #0:3 -> #0:19 (copy) Stream #0:0 -> #0:20 (hevc (native) -> h264 (libx264)) Stream #0:1 -> #0:21 (copy)

I think it is because of the 2 Audio Stream (0:2 and 0:3) that have no Data. I transcoded the video to h264, probed it and it had just the one functioning audio stream, so I was able to transcode it.

Still trying to find a better solution than needing to transcode the video to h264 before creating the DASH and HLS streams.

Hope this helps

@aminyazdanpanah
Copy link
Member

aminyazdanpanah commented Apr 29, 2020

The type of stream num 2 and num 3 are data(or metadata)(see Stream specifiers for more information).

It seems like FFmpeg cannot detect these two streams as data streams and tries to use these for the output codec.

Unfortunately, I cloud not find a valid solution for this problem, so I will be keeping this issue open until I(or someone else) find a better way.

@userlip
Copy link
Author

userlip commented Apr 29, 2020

Ok thanks!

By the way, do you know if there is a faster solution to remove such data streams reliably other than transcoding it to x264?

I am using this code now:

$video = $ffmpeg->open('audio_only.mp4'); $video->save(new FFMpeg\Format\Video\X264('aac', 'libx264'), 'export-x264.mp4');

@aminyazdanpanah
Copy link
Member

see the following page on StackOverflow:
https://stackoverflow.com/questions/38161697/how-to-remove-one-track-from-video-file-using-ffmpeg

Hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants