Opened 6 years ago

Last modified 6 years ago

#5843 reopened enhancement

Read references in swf files

Reported by: TopsLuo Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: swf
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

Summary of the bug:
I am trying to transcode swf to mpegts format,But I failed.
Use the tool to analysis SWF file:

<?xml version="1.0" encoding="utf-8"?>
<SWF type="CWS" Version="9" FileLength="257819" width="640" height="480" FrameRate="18" FrameCount="270">
  <tags count="302">
    <FileAttributes class="zero.swf.tagBodys.FileAttributes" UseGPU="false" UseDirectBlit="false" HasMetadata="false" ActionScript3="false" suppressCrossDomainCaching="false" swfRelativeUrls="false" UseNetwork="true" rest="0x00000000"/>
    <block swfSrc="aa.swf" offset="27" length="257792"/>
  </tags>
</SWF>

,It says the file have 270 frames,buf FFmpeg only decoded one Frame

$ ./bin/ffmpeg.exe -i ../aa.swf test.ts
ffmpeg version N-81635-gbc7066f Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 48.103 / 57. 48.103
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 61.100 /  6. 61.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[swf @ 0000000000726de0] SWF compressed file detected
[swf @ 0000000000726de0] Could not find codec parameters for stream 1 (Video: none, none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[swf @ 0000000000726de0] Could not find codec parameters for stream 2 (Video: vp6f, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, swf, from '../aa.swf':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 640x480, 18 tbr, 18 tbn
    Stream #0:1: Video: none, none, 18 tbr, 18 tbn
    Stream #0:2: Video: vp6f, none, 18 tbr, 18 tbn
[swscaler @ 000000000294ae20] deprecated pixel format used, make sure you did set range correctly
[mpegts @ 00000000028f7de0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mpegts, to 'test.ts':
  Metadata:
    encoder         : Lavf57.48.103
    Stream #0:0: Video: mpeg2video (Main), yuv420p, 640x480, q=2-31, 200 kb/s, 18 fps, 90k tbn, 18 tbc
    Metadata:
      encoder         : Lavc57.55.101 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=5.3 Lsize=      35kB time=00:00:00.00 bitrate=25841454.5kbits/s speed=0.000491x
video:32kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.057426%


Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (3)

aa.swf (249.0 KB ) - added by TopsLuo 6 years ago.
bb.swf (251.8 KB ) - added by Carl Eugen Hoyos 6 years ago.
aa.mp4 (772.4 KB ) - added by TopsLuo 6 years ago.
the output file

Download all attachments as: .zip

Change History (14)

by TopsLuo, 6 years ago

Attachment: aa.swf added

by Carl Eugen Hoyos, 6 years ago

Attachment: bb.swf added

comment:1 by Carl Eugen Hoyos, 6 years ago

Analyzed by developer: unset
Component: ffmpegundetermined
Version: 3.0.2unspecified

Does your "tool" allow to transcode the file you provided? Please upload the expected output.

The (uncompressed) file you provided is 257819 bytes. the (second) jpg ends at position 216518. It is very unlikely that 40k provide 270 frames.

comment:2 by Carl Eugen Hoyos, 6 years ago

Or are you searching for this file?
http://pop.img.ledu.com/5232/flv.f4v

comment:3 by Carl Eugen Hoyos, 6 years ago

Description: modified (diff)

comment:4 by TopsLuo, 6 years ago

Tool name is "SWFtoVideoProPortable 3.12.00",it does transcode sucessful.But where should I upload the output file?

comment:5 by TopsLuo, 6 years ago

Tool name is "SWFtoVideoProPortable 3.12.00",it does transcode sucessful.But where should I upload the output file?

by TopsLuo, 6 years ago

Attachment: aa.mp4 added

the output file

comment:6 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavformat
Priority: normalwish
Reproduced by developer: set
Status: newopen
Summary: FFmpeg decode SWF file errorRead references in swf files
Type: defectenhancement
Version: unspecifiedgit-master

Not sure how likely this is to get implemented.
Does the original file conform to a known specification?

in reply to:  6 comment:7 by TopsLuo, 6 years ago

Replying to cehoyos:

Not sure how likely this is to get implemented.
Does the original file conform to a known specification?

I think YES.Otherwise the tool can't transcoding.

comment:8 by Carl Eugen Hoyos, 6 years ago

Iiuc, the relevant tag is starting at 0x32f88, a DefineSprite tag (39) with length 886 that contains an DoAction tag (12) with length 842. The first action is an ActionConstantPool (0x88) that defines 30 strings (including the relevant parts of the url http://pop.img.ledu.com/5232/flv.f4v), followed by an ActionDefineFunction (0x9b) with the name "video_replay" and several ActionPush actions.

comment:9 by TopsLuo, 6 years ago

Thank you very much.You mean a SWF file has no real video content, but through the URL to specify the video file?

comment:10 by TopsLuo, 6 years ago

Resolution: wontfix
Status: openclosed

comment:11 by Carl Eugen Hoyos, 6 years ago

Resolution: wontfix
Status: closedreopened

I don't disagree strongly but there are quite a few tickets open that are less likely to get implemented.

Note: See TracTickets for help on using tickets.