GBVideoPlayer2 icon indicating copy to clipboard operation
GBVideoPlayer2 copied to clipboard

Use y4m as the container format for raw video

Open frestr opened this issue 5 years ago • 9 comments

On Linux (Ubuntu 18.04) with ffmpeg 4.1.3 I get the following error when compiling a video:

Resizing video...
ffmpeg -loglevel warning -stats -hide_banner -i video.mkv -c:v rawvideo  -vf scale=-2:144 output/
[...]
[mp4 @ 0x55eb35bdd380] Could not find tag for codec rawvideo 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:0 --                                                                   
[aac @ 0x55eb35b78440] 2 frames left in the queue on closing                                              
[...]                               

Apparently rawvideo is not supported for mp4. This PR uses y4m as a container format intead, which seems to work fine.

Note that I have not tested it on other platforms.

(Edit: This is in addition to #3)

frestr avatar Nov 02 '19 13:11 frestr

It's a tech demo and not an actively maintained project. The codebase, in fact, did work out of the box when it was released, but was broken by an update to ffmpeg. Testing this fix and making sure it doesn't actually break users of older versions of ffmpeg was not prioritized over my other projects.

LIJI32 avatar Aug 05 '20 22:08 LIJI32

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator

If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

sjr765 avatar Jun 08 '22 21:06 sjr765

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator

If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

Seems like ffmpeg version 5.0 changed some things that caused it to break. As a workaround for now you can try downgrading to 4.4.

TheEssem avatar Jun 11 '22 01:06 TheEssem

@TheEssem I was actually able to get this program to run by doing a combination of the following (I'm on mac):

  • using ffmpeg@4 on homebrew
  • installing rgbds v0.3.7
  • integrating the pull request from @frestr into the code

sjr765 avatar Jun 11 '22 20:06 sjr765

@sjr765

installing rgbds v0.3.7

How did you install v0.3.7 on Mac? It seems brew doesn't find it, so I guess you had to install via source. but on source, it complains:

Package libpng was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpng.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpng' found
Package libpng was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpng.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpng' found

jdriselvato avatar Oct 13 '22 19:10 jdriselvato

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

Seems like ffmpeg version 5.0 changed some things that caused it to break. As a workaround for now you can try downgrading to 4.4.

add -rle 0 as an ffmpeg argument on line 50 of the makefile to work around this issue.

Jenetrix avatar Dec 20 '22 15:12 Jenetrix

Hey All,

Just a headsup, I believe if you specify the version on brew it should be able to find the proper version of the dependencies you need.

I did not use homebrew to install rgbds v0.3.7, its been a while but pretty confident I installed it manually!

sjr765 avatar Dec 21 '22 05:12 sjr765

Hi @frestr, a bit of a long shot here, but I've incorporated your code which works well but when I get the gbc file it seems to be all entirely corrupted video (though I do hear the audio). The video just seems to be super unwatchable, almost like tv static. I've only tested this on the SameBoy gameboy emulator If you have any tips, that would be great, if not, no worries! Thanks again for the fix.

Seems like ffmpeg version 5.0 changed some things that caused it to break. As a workaround for now you can try downgrading to 4.4.

add -rle 0 as an ffmpeg argument on line 50 of the makefile to work around this issue.

Soo... I'm using rgbds 0.3.7, ffmpeg 4.4. I've edited Makefile for changes in a commit and yet it still throws me ROM with video, like TV static. Adding "-rle 0" to line 50 just throws this:

Codec AVOption rle (Use run-length compression) specified for input file #0 (output/niecik3/video.y4m) is not a decoding option.

I'm kinda lost and dumno how to fix it.

TehMiloss avatar Mar 07 '23 00:03 TehMiloss

Soo... I'm using rgbds 0.3.7, ffmpeg 4.4. I've edited Makefile for changes in a commit and yet it still throws me ROM with video, like TV static. Adding "-rle 0" to line 50 just throws this:

Codec AVOption rle (Use run-length compression) specified for input file #0 (output/niecik3/video.y4m) is not a decoding option.

I'm kinda lost and dumno how to fix it.

This is fix is specific to ffmpeg 5.0 and onward, you do not need to add this option for ffmpeg 4.4.

Jenetrix avatar Apr 12 '23 12:04 Jenetrix